mellon-server
Advanced tools
Comparing version 1.0.7 to 1.0.8
14
index.js
@@ -49,3 +49,3 @@ const http = require('http'); | ||
} | ||
else if (pathItem.endsWith('/') && stat && stat.isDirectory()) { | ||
else if ((pathItem === "" || pathItem.endsWith('/')) && stat && stat.isDirectory()) { | ||
doDir(`${public_dir}/${pathItem}`,pathItem,req,res); | ||
@@ -130,3 +130,13 @@ } | ||
lsDir.forEach( (entry) => { | ||
content += `<a href="${baseUrl}/${pathItem}${entry}">${entry}</a><br>` | ||
const stat = fs.lstatSync(`${path}${entry}`); | ||
if (stat && stat.isFile()) { | ||
content += `<a href="${baseUrl}/${pathItem}${entry}">${entry}</a><br>` | ||
} | ||
else if (stat && stat.isDirectory()) { | ||
content += `<a href="${baseUrl}/${pathItem}${entry}/">${entry}/</a><br>` | ||
} | ||
else { | ||
// Do nothing | ||
} | ||
}); | ||
@@ -133,0 +143,0 @@ content += '</body></html>'; |
{ | ||
"name": "mellon-server", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "A small hackable HTTP server", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6852
161