fix false Attempted path traversal attack - alarm on win
This commit is contained in:
parent
45c7f53777
commit
82e02c1db8
@ -31,7 +31,8 @@ const getArgs = function () {
|
|||||||
const getSafeFilePath = function (rootPath, singleFileSegment) {
|
const getSafeFilePath = function (rootPath, singleFileSegment) {
|
||||||
var filePath = path.join(rootPath, singleFileSegment);
|
var filePath = path.join(rootPath, singleFileSegment);
|
||||||
if (
|
if (
|
||||||
path.dirname(filePath) !== rootPath ||
|
(path.dirname(filePath) !== rootPath &&
|
||||||
|
path.dirname(filePath) !== rootPath.replace("/", "\\")) ||
|
||||||
path.basename(filePath) !== singleFileSegment ||
|
path.basename(filePath) !== singleFileSegment ||
|
||||||
path.normalize(singleFileSegment) !== singleFileSegment
|
path.normalize(singleFileSegment) !== singleFileSegment
|
||||||
) {
|
) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user