1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add proper error handling for 404 errors when serving debug files

This commit is contained in:
Nick O'Leary 2021-11-26 11:30:51 +00:00
parent 3e0f080ea7
commit 04ffa06221
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -280,6 +280,18 @@ module.exports = function(RED) {
root: path.join(__dirname,"lib","debug"), root: path.join(__dirname,"lib","debug"),
dotfiles: 'deny' dotfiles: 'deny'
}; };
res.sendFile(req.params[0], options); try {
res.sendFile(
req.params[0],
options,
err => {
if (err) {
res.sendStatus(404);
}
}
)
} catch(err) {
res.sendStatus(404);
}
}); });
}; };