blob: ac5f2549e5ff45f3deee66e64668277e951577fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
const fs = require('fs');
const url = require('url');
/**
* @param {string} url
*/
module.exports = (efs) => {
cfs = url.parse(efs, true).pathname;
if (fs.existsSync("./public/" + cfs) && !fs.lstatSync("./public/" + cfs).isDirectory()) {
return "./public/" + cfs;
} else if (fs.existsSync("./public/" + cfs + "/index.php")) {
return "./public/" + cfs + "/index.php";
} else if (fs.existsSync("./public/" + cfs + "/index.html")) {
return "./public/" + cfs + "/index.html";
} else if (fs.existsSync("./public/" + cfs)) {
return "./public/" + cfs;
} else if (cfs.endsWith(".htaccess")) {
return null;
} else {
return null;
}
}
|