Correct path segment regex (#44149)

The old version incorrectly matched anything with a leading or trailing
slash.  The empty segment should only be detected between two slashes.
This commit is contained in:
Andrew Casey
2021-05-20 10:54:15 -07:00
committed by GitHub
parent 89a737c871
commit 87d0b3e07a

View File

@@ -658,7 +658,7 @@ namespace ts {
//// Path Comparisons
// check path for these segments: '', '.'. '..'
const relativePathSegmentRegExp = /(^|\/)\.{0,2}($|\/)/;
const relativePathSegmentRegExp = /(?:\/\/)|(?:^|\/)\.\.?(?:$|\/)/;
function comparePathsWorker(a: string, b: string, componentComparer: (a: string, b: string) => Comparison) {
if (a === b) return Comparison.EqualTo;