Skip to content

Commit 87d0b3e

Browse files
authored
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.
1 parent 89a737c commit 87d0b3e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/compiler/path.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ namespace ts {
658658
//// Path Comparisons
659659

660660
// check path for these segments: '', '.'. '..'
661-
const relativePathSegmentRegExp = /(^|\/)\.{0,2}($|\/)/;
661+
const relativePathSegmentRegExp = /(?:\/\/)|(?:^|\/)\.\.?(?:$|\/)/;
662662

663663
function comparePathsWorker(a: string, b: string, componentComparer: (a: string, b: string) => Comparison) {
664664
if (a === b) return Comparison.EqualTo;

0 commit comments

Comments
 (0)