From d89163110e3e2b575283aebda641e2fe9dfa7812 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 16 Oct 2017 13:40:49 +0100 Subject: [PATCH] Fix the glob-to-regex code It was only making one replacement so would fail for anything with more than ine glob special char (eg. *foo would be fine, but *foo* was broken) --- src/pushprocessor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pushprocessor.js b/src/pushprocessor.js index 5b35ccdf4..a5cc9504a 100644 --- a/src/pushprocessor.js +++ b/src/pushprocessor.js @@ -215,9 +215,9 @@ function PushProcessor(client) { // Because micromatch is about 130KB with dependencies, // and minimatch is not much better. let pat = escapeRegExp(glob); - pat = pat.replace(/\\\*/, '.*'); - pat = pat.replace(/\?/, '.'); - pat = pat.replace(/\\\[(!|)(.*)\\]/, function(match, p1, p2, offset, string) { + pat = pat.replace(/\\\*/g, '.*'); + pat = pat.replace(/\?/g, '.'); + pat = pat.replace(/\\\[(!|)(.*)\\]/g, function(match, p1, p2, offset, string) { const first = p1 && '^' || ''; const second = p2.replace(/\\\-/, '-'); return '[' + first + second + ']';