Skip to content

Commit 4de1259

Browse files
timursevimlitshemsedinov
authored andcommitted
Fix root basename
1 parent bed93f1 commit 4de1259

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

JavaScript/d-messenger/lib/static.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = (root, port, console) => {
2828
.createServer(async (req, res) => {
2929
const url = req.url === '/' ? '/index.html' : req.url;
3030
const filePath = path.join(root, url);
31-
if (!filePath.startsWith(root)) {
31+
if (!filePath.startsWith(path.basename(root))) {
3232
res.statusCode = 404;
3333
return void res.end('"File is not found"');
3434
}

0 commit comments

Comments
 (0)