minimatch
Advanced tools
Comparing version 9.0.0 to 9.0.1
@@ -611,11 +611,15 @@ "use strict"; | ||
const options = this.options; | ||
// a UNC pattern like //?/c:/* can match a path like c:/x | ||
// and vice versa | ||
// UNC paths like //?/X:/... can match X:/... and vice versa | ||
// Drive letters in absolute drive or unc paths are always compared | ||
// case-insensitively. | ||
if (this.isWindows) { | ||
const fileUNC = file[0] === '' && | ||
const fileDrive = typeof file[0] === 'string' && /^[a-z]:$/i.test(file[0]); | ||
const fileUNC = !fileDrive && | ||
file[0] === '' && | ||
file[1] === '' && | ||
file[2] === '?' && | ||
typeof file[3] === 'string' && | ||
/^[a-z]:$/i.test(file[3]); | ||
const patternUNC = pattern[0] === '' && | ||
const patternDrive = typeof pattern[0] === 'string' && /^[a-z]:$/i.test(pattern[0]); | ||
const patternUNC = !patternDrive && | ||
pattern[0] === '' && | ||
pattern[1] === '' && | ||
@@ -625,24 +629,16 @@ pattern[2] === '?' && | ||
/^[a-z]:$/i.test(pattern[3]); | ||
if (fileUNC && patternUNC) { | ||
const fd = file[3]; | ||
const pd = pattern[3]; | ||
const fdi = fileUNC ? 3 : fileDrive ? 0 : undefined; | ||
const pdi = patternUNC ? 3 : patternDrive ? 0 : undefined; | ||
if (typeof fdi === 'number' && typeof pdi === 'number') { | ||
const [fd, pd] = [file[fdi], pattern[pdi]]; | ||
if (fd.toLowerCase() === pd.toLowerCase()) { | ||
file[3] = pd; | ||
pattern[pdi] = fd; | ||
if (pdi > fdi) { | ||
pattern = pattern.slice(pdi); | ||
} | ||
else if (fdi > pdi) { | ||
file = file.slice(fdi); | ||
} | ||
} | ||
} | ||
else if (patternUNC && typeof file[0] === 'string') { | ||
const pd = pattern[3]; | ||
const fd = file[0]; | ||
if (pd.toLowerCase() === fd.toLowerCase()) { | ||
pattern[3] = fd; | ||
pattern = pattern.slice(3); | ||
} | ||
} | ||
else if (fileUNC && typeof pattern[0] === 'string') { | ||
const fd = file[3]; | ||
if (fd.toLowerCase() === pattern[0].toLowerCase()) { | ||
pattern[0] = fd; | ||
file = file.slice(3); | ||
} | ||
} | ||
} | ||
@@ -649,0 +645,0 @@ // resolve and reduce . and .. portions in the file as well. |
@@ -599,11 +599,15 @@ import expand from 'brace-expansion'; | ||
const options = this.options; | ||
// a UNC pattern like //?/c:/* can match a path like c:/x | ||
// and vice versa | ||
// UNC paths like //?/X:/... can match X:/... and vice versa | ||
// Drive letters in absolute drive or unc paths are always compared | ||
// case-insensitively. | ||
if (this.isWindows) { | ||
const fileUNC = file[0] === '' && | ||
const fileDrive = typeof file[0] === 'string' && /^[a-z]:$/i.test(file[0]); | ||
const fileUNC = !fileDrive && | ||
file[0] === '' && | ||
file[1] === '' && | ||
file[2] === '?' && | ||
typeof file[3] === 'string' && | ||
/^[a-z]:$/i.test(file[3]); | ||
const patternUNC = pattern[0] === '' && | ||
const patternDrive = typeof pattern[0] === 'string' && /^[a-z]:$/i.test(pattern[0]); | ||
const patternUNC = !patternDrive && | ||
pattern[0] === '' && | ||
pattern[1] === '' && | ||
@@ -613,24 +617,16 @@ pattern[2] === '?' && | ||
/^[a-z]:$/i.test(pattern[3]); | ||
if (fileUNC && patternUNC) { | ||
const fd = file[3]; | ||
const pd = pattern[3]; | ||
const fdi = fileUNC ? 3 : fileDrive ? 0 : undefined; | ||
const pdi = patternUNC ? 3 : patternDrive ? 0 : undefined; | ||
if (typeof fdi === 'number' && typeof pdi === 'number') { | ||
const [fd, pd] = [file[fdi], pattern[pdi]]; | ||
if (fd.toLowerCase() === pd.toLowerCase()) { | ||
file[3] = pd; | ||
pattern[pdi] = fd; | ||
if (pdi > fdi) { | ||
pattern = pattern.slice(pdi); | ||
} | ||
else if (fdi > pdi) { | ||
file = file.slice(fdi); | ||
} | ||
} | ||
} | ||
else if (patternUNC && typeof file[0] === 'string') { | ||
const pd = pattern[3]; | ||
const fd = file[0]; | ||
if (pd.toLowerCase() === fd.toLowerCase()) { | ||
pattern[3] = fd; | ||
pattern = pattern.slice(3); | ||
} | ||
} | ||
else if (fileUNC && typeof pattern[0] === 'string') { | ||
const fd = file[3]; | ||
if (fd.toLowerCase() === pattern[0].toLowerCase()) { | ||
pattern[0] = fd; | ||
file = file.slice(3); | ||
} | ||
} | ||
} | ||
@@ -637,0 +633,0 @@ // resolve and reduce . and .. portions in the file as well. |
@@ -5,3 +5,3 @@ { | ||
"description": "a glob matcher in javascript", | ||
"version": "9.0.0", | ||
"version": "9.0.1", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
428478
3832