Skip to content

Commit 32f6d52

Browse files
authored
fix!: Correct mishandled escaped path separators (#34)
Closes #32
1 parent aa91a48 commit 32f6d52

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var isWin32 = require('os').platform() === 'win32';
66

77
var slash = '/';
88
var backslash = /\\/g;
9-
var enclosure = /[{[].*[}\]]$/;
9+
var enclosure = /[{[].*\/.*[}\]]$/;
1010
var globby = /(^|[^\\])([{[]|\([^)]+$)/;
1111
var escaped = /\\([!*?|[\](){}])/g;
1212

test/index.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ describe('glob-parent', function () {
7777
'path/[foo bar]/subdir'
7878
);
7979
expect(gp('path/\\[bar]/')).toEqual('path/[bar]');
80-
expect(gp('path/\\[bar]')).toEqual('path/[bar]');
80+
expect(gp('path/\\[bar]')).toEqual('path');
8181
expect(gp('[bar]')).toEqual('.');
8282
expect(gp('[bar]/')).toEqual('.');
83-
expect(gp('./\\[bar]')).toEqual('./[bar]');
83+
expect(gp('./\\[bar]')).toEqual('.');
8484
expect(gp('\\[bar]/')).toEqual('[bar]');
8585
expect(gp('\\!dir/*')).toEqual('!dir');
8686
expect(gp('[bar\\]/')).toEqual('.');
@@ -95,9 +95,9 @@ describe('glob-parent', function () {
9595
expect(gp('foo-\\(bar\\).md')).toEqual('foo-');
9696
} else {
9797
expect(gp('foo-\\(bar\\).md')).toEqual('.');
98-
expect(gp('\\[bar]')).toEqual('[bar]');
98+
expect(gp('\\[bar]')).toEqual('.');
9999
expect(gp('[bar\\]')).toEqual('.');
100-
expect(gp('\\{foo,bar\\}')).toEqual('{foo,bar}');
100+
expect(gp('\\{foo,bar\\}')).toEqual('.');
101101
expect(gp('{foo,bar\\}')).toEqual('.');
102102
}
103103

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy