Skip to content

Commit fb08a30

Browse files
mrmlncdanez
authored andcommittedApr 10, 2021
fix: do not skip pattern seperator for square brackets
1 parent 032e3f5 commit fb08a30

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed
 

‎lib/scan.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,15 @@ const scan = (input, options) => {
231231
isBracket = token.isBracket = true;
232232
isGlob = token.isGlob = true;
233233
finished = true;
234-
235-
if (scanToEnd === true) {
236-
continue;
237-
}
238234
break;
239235
}
240236
}
237+
238+
if (scanToEnd === true) {
239+
continue;
240+
}
241+
242+
break;
241243
}
242244

243245
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {

‎test/api.scan.js

+4
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ describe('picomatch', () => {
311311

312312
assertParts('XXX/*/*/12/*/*/m/*/*', ['XXX', '*', '*', '12', '*', '*', 'm', '*', '*']);
313313
assertParts('foo/\\"**\\"/bar', ['foo', '\\"**\\"', 'bar']);
314+
315+
assertParts('[0-9]/[0-9]', ['[0-9]', '[0-9]']);
316+
assertParts('foo/[0-9]/[0-9]', ['foo', '[0-9]', '[0-9]']);
317+
assertParts('foo[0-9]/bar[0-9]', ['foo[0-9]', 'bar[0-9]']);
314318
});
315319
});
316320

0 commit comments

Comments
 (0)
Please sign in to comment.