Skip to content

Commit

Permalink
Merge pull request #423 from mrmlnc/ISSUE-422_fix_escaped_braces_regr…
Browse files Browse the repository at this point in the history
…ession

ISSUE-422: keep escaping after brace expansion
  • Loading branch information
mrmlnc authored Sep 20, 2023
2 parents a47f976 + e962161 commit 28a3d61
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/utils/pattern.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,14 @@ describe('Utils → Pattern', () => {

assert.deepStrictEqual(actual, expected);
});

it('should keep escaping after expansion', () => {
const expected = ['foo@(\\\\)/**/*.a', 'foo@(\\\\)/**/*.b'];

const actual = util.expandBraceExpansion('foo@(\\\\)/**/{*.a,*.b}');

assert.deepStrictEqual(actual, expected);
});
});

describe('.getPatternParts', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export function expandPatternsWithBraceExpansion(patterns: Pattern[]): Pattern[]
}

export function expandBraceExpansion(pattern: Pattern): Pattern[] {
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true });
const patterns = micromatch.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });

/**
* Sort the patterns by length so that the same depth patterns are processed side by side.
Expand Down

0 comments on commit 28a3d61

Please sign in to comment.