We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 97cd036 commit c8120ceCopy full SHA for c8120ce
src/registry/routes/static-redirector.js
@@ -46,6 +46,12 @@ module.exports = function(repository) {
46
res.errorDetails = `File ${filePath} not found`;
47
return res.status(404).json({ err: res.errorDetails });
48
}
49
+
50
+ const stats = fs.statSync(filePath);
51
+ if (stats.isDirectory()) {
52
+ res.errorDetails = 'Forbidden: Directory Listing Denied';
53
+ return res.status(403).json({ err: res.errorDetails });
54
+ }
55
56
const fileStream = fs.createReadStream(filePath),
57
fileInfo = getFileInfo(filePath);
0 commit comments