Skip to content

Commit ea9c73a

Browse files
authored
Update glob.ts
fixed for angular-ui#2438, prevent matches for *.** based patterns.
1 parent a65c58f commit ea9c73a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/common/glob.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ export class Glob {
1616
matches(name: string) {
1717
let segments = name.split('.');
1818

19-
// match single stars
20-
for (let i = 0, l = this.glob.length; i < l; i++) {
21-
if (this.glob[i] === '*') segments[i] = '*';
22-
}
23-
2419
// match greedy starts
2520
if (this.glob[0] === '**') {
2621
segments = segments.slice(segments.indexOf(this.glob[1]));
@@ -31,6 +26,12 @@ export class Glob {
3126
segments.splice(segments.indexOf(this.glob[this.glob.length - 2]) + 1, Number.MAX_VALUE);
3227
segments.push('**');
3328
}
29+
30+
// match single stars
31+
for (let i = 0, l = this.glob.length; i < l; i++) {
32+
if (this.glob[i] === '*' && segments.length > i) segments[i] = '*';
33+
}
34+
3435
if (this.glob.length != segments.length) return false;
3536

3637
return segments.join('') === this.glob.join('');

0 commit comments

Comments
 (0)