Skip to content

Commit

Permalink
Fix root basename
Browse files Browse the repository at this point in the history
  • Loading branch information
timursevimli authored and tshemsedinov committed Aug 22, 2023
1 parent bed93f1 commit 4de1259
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion JavaScript/d-messenger/lib/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = (root, port, console) => {
.createServer(async (req, res) => {
const url = req.url === '/' ? '/index.html' : req.url;
const filePath = path.join(root, url);
if (!filePath.startsWith(root)) {
if (!filePath.startsWith(path.basename(root))) {
res.statusCode = 404;
return void res.end('"File is not found"');
}
Expand Down

0 comments on commit 4de1259

Please sign in to comment.