File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -5,15 +5,15 @@ var isglob = require('is-glob');
5
5
var pathDirname = require ( 'path-dirname' ) ;
6
6
7
7
module . exports = function globParent ( str ) {
8
- // replace braces/brackets sections with *
9
- str = str . replace ( / ( ^ | [ ^ \\ ] ) ( \{ ( [ ^ { } ] * ?) } | \[ ( [ ^ \[ \] ] * ?) \] ) / g, '$1*' ) ;
10
- if ( / [ \} \] ] $ / . test ( str ) ) str += '/' ;
8
+ // special case for strings ending in enclosure containing path separator
9
+ if ( / [ \{ \[ ] .* [ \/ ] * .* [ \} \] ] $ / . test ( str ) ) str += '/' ;
11
10
12
11
// preserves full path in case of trailing path separator
13
12
str += 'a' ;
14
13
15
14
// remove path parts that are globby
16
- do { str = pathDirname . posix ( str ) } while ( isglob ( str ) ) ;
15
+ do { str = pathDirname . posix ( str ) }
16
+ while ( isglob ( str ) || / ( ^ | [ ^ \\ ] ) [ \{ \[ ] / . test ( str ) ) ;
17
17
18
18
// remove escape chars and return result
19
19
return str . replace ( / \\ ( [ \* \? \| \[ \] \( \) \{ \} ] ) / g, '$1' ) ;
You can’t perform that action at this time.
0 commit comments