From 6e99f5bc4e83010f32c60a028469d1e7d282e9ea Mon Sep 17 00:00:00 2001 From: Josh Cartmell <764456+joshcartme@users.noreply.github.com> Date: Fri, 30 May 2025 16:10:21 -0700 Subject: [PATCH 1/2] Strip glob patterns from include basePath Absolute paths like "/some/path/glob/**" were getting through when the correct path would be "/some/path/glob" --- internal/vfs/utilities.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/vfs/utilities.go b/internal/vfs/utilities.go index e496bf6867..d5992786e6 100644 --- a/internal/vfs/utilities.go +++ b/internal/vfs/utilities.go @@ -248,7 +248,7 @@ func getIncludeBasePath(absolute string) string { return tspath.RemoveTrailingDirectorySeparator(tspath.GetDirectoryPath(absolute)) } } - return absolute[:strings.LastIndex(absolute, string(tspath.DirectorySeparator))] + return absolute[:strings.LastIndex(absolute[:wildcardOffset], string(tspath.DirectorySeparator))] } // getBasePaths computes the unique non-wildcard base paths amongst the provided include patterns. From b553b08de165c1b93425841f436b095def74588c Mon Sep 17 00:00:00 2001 From: Bread <764456+joshcartme@users.noreply.github.com> Date: Fri, 30 May 2025 16:38:40 -0700 Subject: [PATCH 2/2] Protect against a negative index slice --- internal/vfs/utilities.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/vfs/utilities.go b/internal/vfs/utilities.go index d5992786e6..752ba14d21 100644 --- a/internal/vfs/utilities.go +++ b/internal/vfs/utilities.go @@ -248,7 +248,7 @@ func getIncludeBasePath(absolute string) string { return tspath.RemoveTrailingDirectorySeparator(tspath.GetDirectoryPath(absolute)) } } - return absolute[:strings.LastIndex(absolute[:wildcardOffset], string(tspath.DirectorySeparator))] + return absolute[:max(strings.LastIndex(absolute[:wildcardOffset], string(tspath.DirectorySeparator)), 0)] } // getBasePaths computes the unique non-wildcard base paths amongst the provided include patterns.