Skip to content

Commit bd5bc06

Browse files
authored
Merge pull request #909 from siluet/master
fix for issue 907
2 parents 97cd036 + c8120ce commit bd5bc06

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/registry/routes/static-redirector.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ module.exports = function(repository) {
4646
res.errorDetails = `File ${filePath} not found`;
4747
return res.status(404).json({ err: res.errorDetails });
4848
}
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+
}
4955

5056
const fileStream = fs.createReadStream(filePath),
5157
fileInfo = getFileInfo(filePath);

0 commit comments

Comments
 (0)