From a9946a3b18ff12443ba5138f13c43eec4a539a52 Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Mon, 19 Feb 2024 10:28:38 +0100 Subject: [PATCH] fix(utils): set nocase=true for minimatch (#27412) --- lib/util/string-match.spec.ts | 4 ++++ lib/util/string-match.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/util/string-match.spec.ts b/lib/util/string-match.spec.ts index a27a1d29cc..0321d4ce57 100644 --- a/lib/util/string-match.spec.ts +++ b/lib/util/string-match.spec.ts @@ -30,6 +30,10 @@ describe('util/string-match', () => { expect(matchRegexOrGlobList('test', ['test', '!/test3/'])).toBeTrue(); }); + it('returns true case insensitive for glob', () => { + expect(matchRegexOrGlobList('TEST', ['t*'])).toBeTrue(); + }); + it('returns true if matching every negative pattern (regex)', () => { expect( matchRegexOrGlobList('test', ['test', '!/test3/', '!/test4/']), diff --git a/lib/util/string-match.ts b/lib/util/string-match.ts index 8612ba5e33..241debfbd1 100644 --- a/lib/util/string-match.ts +++ b/lib/util/string-match.ts @@ -14,7 +14,7 @@ export function getRegexOrGlobPredicate(pattern: string): StringMatchPredicate { return regExPredicate; } - const mm = minimatch(pattern, { dot: true }); + const mm = minimatch(pattern, { dot: true, nocase: true }); return (x: string): boolean => mm.match(x); } -- GitLab