1
0
Fork 0
forked from svrjs/svrjs

Rename properDirectoryListingServe function to properDirectoryListingAndStaticFileServe.

This commit is contained in:
Dorian Niemiec 2023-09-12 19:50:39 +02:00
parent 75e987dcf4
commit c8c069aceb
2 changed files with 7 additions and 7 deletions

View file

@ -3,7 +3,7 @@
"port": 80,
"pubport": 80,
"page404": "404.html",
"timestamp": 1694539313104,
"timestamp": 1694540087592,
"blacklist": [],
"nonStandardCodes": [],
"enableCompression": true,

12
svr.js
View file

@ -3402,13 +3402,13 @@ if (!cluster.isPrimary) {
if (e || !s.isFile()) {
fs.stat((readFrom + "/index.xhtml").replace(/\/+/g, "/"), function (e, s) {
if (e || !s.isFile()) {
properDirectoryListingServe();
properDirectoryListingAndStaticFileServe();
} else {
stats = s;
pth = (pth + "/index.xhtml").replace(/\/+/g, "/");
ext = "xhtml";
readFrom = "./" + pth;
properDirectoryListingServe();
properDirectoryListingAndStaticFileServe();
}
});
} else {
@ -3416,7 +3416,7 @@ if (!cluster.isPrimary) {
pth = (pth + "/index.htm").replace(/\/+/g, "/");
ext = "htm";
readFrom = "./" + pth;
properDirectoryListingServe();
properDirectoryListingAndStaticFileServe();
}
});
} else {
@ -3424,14 +3424,14 @@ if (!cluster.isPrimary) {
pth = (pth + "/index.html").replace(/\/+/g, "/");
ext = "html";
readFrom = "./" + pth;
properDirectoryListingServe();
properDirectoryListingAndStaticFileServe();
}
});
} else {
properDirectoryListingServe();
properDirectoryListingAndStaticFileServe();
}
function properDirectoryListingServe() {
function properDirectoryListingAndStaticFileServe() {
if (stats.isDirectory()) {
// Check if directory listing is enabled in the configuration
if (checkForEnabledDirectoryListing(req.headers.host)) {