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 authored and GitHub committed 2021-05-20 10:54:15 -07:00
1 parent 89a737c871
commit 87d0b3e07a
1 file changed
+1 -1
+1 -1
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;