Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alert on wsl.localhost Path #1522

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion internal/uri/uri.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,13 @@ func IsWSLURI(uri string) bool {
return false
}

return u.Scheme == "file" && u.Host == "wsl$"
if u.Scheme == "file" && u.Host == "wsl$" {
return true
}

if u.Scheme == "file" && u.Host == "wsl.localhost" {
return true
}

return false
}
5 changes: 5 additions & 0 deletions internal/uri/uri_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ func TestIsWSLURI(t *testing.T) {
uri: `file://wsl%24/Ubuntu/home/james/some/path`,
want: true,
},
{
name: "Localhost WSL file path should return true",
uri: `file://wsl.localhost/Ubuntu/home/james/foo`,
want: true,
},
{
name: "Regular file path should return false",
uri: `file://C:/foo/james/foo`,
Expand Down