From bed2671a7326d474937a9bde8a125637f578b660 Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 27 Apr 2021 09:18:07 +0200 Subject: [PATCH] averify that the path is not a folder --- utils/file.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils/file.js b/utils/file.js index 80e7c63..b8ca192 100644 --- a/utils/file.js +++ b/utils/file.js @@ -337,6 +337,9 @@ module.exports.isFilePathValid = async (options) => { ); if (ofs.existsSync(anonymizedFilePath)) { + if (fs.lstatSync(anonymizedFilePath).isDirectory()) { + throw "is_folder"; + } return true; } @@ -367,6 +370,9 @@ module.exports.isFilePathValid = async (options) => { ); if (ofs.existsSync(originalFilePath)) { + if (fs.lstatSync(originalFilePath).isDirectory()) { + throw "is_folder"; + } if (!module.exports.isFileSupported(repoConfig, originalFilePath)) { throw "file_not_supported"; }