Skip to content

Commit 0c3317b

Browse files
committed
Use filepath.ToSlash to ensure URIs are using slashes
Signed-off-by: Remy Suen <[email protected]>
1 parent 6659667 commit 0c3317b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/bake/hcl/documentLink_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestDocumentLink(t *testing.T) {
1818
testsFolder := filepath.Join(os.TempDir(), "documentLinkTests")
1919
userFolder := filepath.Join(testsFolder, "user")
2020
bakeFilePath := filepath.Join(userFolder, "docker-bake.hcl")
21-
bakeFileStringURI := fmt.Sprintf("file:///%v", strings.TrimPrefix(bakeFilePath, "/"))
21+
bakeFileStringURI := fmt.Sprintf("file:///%v", strings.TrimPrefix(filepath.ToSlash(bakeFilePath), "/"))
2222

2323
testCases := []struct {
2424
name string
@@ -90,7 +90,7 @@ func TestDocumentLink(t *testing.T) {
9090
} else {
9191
link := protocol.DocumentLink{
9292
Range: tc.linkRange,
93-
Target: types.CreateStringPointer(fmt.Sprintf("file:///%v", strings.TrimPrefix(tc.path, "/"))),
93+
Target: types.CreateStringPointer(fmt.Sprintf("file:///%v", strings.TrimPrefix(filepath.ToSlash(tc.path), "/"))),
9494
Tooltip: types.CreateStringPointer(tc.path),
9595
}
9696
require.Equal(t, []protocol.DocumentLink{link}, links)

0 commit comments

Comments
 (0)