From e1834d02a62b170456b129021f41bdaefa7d16dc Mon Sep 17 00:00:00 2001 From: Hyunsuk Jo Date: Mon, 13 Jul 2020 21:51:31 +0900 Subject: [PATCH] Escape square brackets before globby fixes #4855 --- lib/standalone.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/standalone.js b/lib/standalone.js index 34190d312b..fd0ff02063 100644 --- a/lib/standalone.js +++ b/lib/standalone.js @@ -184,6 +184,20 @@ module.exports = function (options) { fileCache.destroy(); } + // Escape square brackets + fileList = fileList.map((p) => { + let result = p; + + if (result.match(/[[\]]/g)) { + result = result.split('[').join('\\['); + result = result.split(']').join('\\]'); + + return result; + } + + return p; + }); + return globby(fileList, globbyOptions) .then((filePaths) => { // The ignorer filter needs to check paths relative to cwd