fix false Attempted path traversal attack - alarm on win

This commit is contained in:
Raphael 2022-01-25 14:20:03 +01:00
parent 45c7f53777
commit 82e02c1db8

View File

@ -31,7 +31,8 @@ const getArgs = function () {
const getSafeFilePath = function (rootPath, singleFileSegment) {
var filePath = path.join(rootPath, singleFileSegment);
if (
path.dirname(filePath) !== rootPath ||
(path.dirname(filePath) !== rootPath &&
path.dirname(filePath) !== rootPath.replace("/", "\\")) ||
path.basename(filePath) !== singleFileSegment ||
path.normalize(singleFileSegment) !== singleFileSegment
) {