@@ -472,16 +472,23 @@ class Minimatch {
472472 this . debug ( '%s\t%s %s %j' , pattern , i , re , c )
473473
474474 // skip over any that are escaped.
475- if ( escaping && reSpecials [ c ] ) {
476- re += '\\' + c
475+ if ( escaping ) {
476+ /* istanbul ignore next - completely not allowed, even escaped. */
477+ if ( c === '/' ) {
478+ return false
479+ }
480+
481+ if ( reSpecials [ c ] ) {
482+ re += '\\'
483+ }
484+ re += c
477485 escaping = false
478486 continue
479487 }
480488
481489 switch ( c ) {
482490 /* istanbul ignore next */
483491 case '/' : {
484- // completely not allowed, even escaped.
485492 // Should already be path-split by now.
486493 return false
487494 }
@@ -564,9 +571,8 @@ class Minimatch {
564571 continue
565572
566573 case '|' :
567- if ( inClass || ! patternListStack . length || escaping ) {
574+ if ( inClass || ! patternListStack . length ) {
568575 re += '\\|'
569- escaping = false
570576 continue
571577 }
572578
@@ -597,7 +603,6 @@ class Minimatch {
597603 // first in the list. -- POSIX.2 2.8.3.2
598604 if ( i === classStart + 1 || ! inClass ) {
599605 re += '\\' + c
600- escaping = false
601606 continue
602607 }
603608
@@ -632,15 +637,12 @@ class Minimatch {
632637 // swallow any state char that wasn't consumed
633638 clearStateChar ( )
634639
635- if ( escaping ) {
636- // no need
637- escaping = false
638- } else if ( reSpecials [ c ]
639- && ! ( c === '^' && inClass ) ) {
640+ if ( reSpecials [ c ] && ! ( c === '^' && inClass ) ) {
640641 re += '\\'
641642 }
642643
643644 re += c
645+ break
644646
645647 } // switch
646648 } // for
@@ -670,6 +672,7 @@ class Minimatch {
670672 this . debug ( 'setting tail' , re , pl )
671673 // maybe some even number of \, then maybe 1 \, followed by a |
672674 tail = tail . replace ( / ( (?: \\ { 2 } ) { 0 , 64 } ) ( \\ ? ) \| / g, ( _ , $1 , $2 ) => {
675+ /* istanbul ignore else - should already be done */
673676 if ( ! $2 ) {
674677 // the | isn't already escaped, so escape it.
675678 $2 = '\\'
0 commit comments