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