diff --git a/internal/parser/encoding.go b/internal/parser/encoding.go index 63905ef..d759b94 100644 --- a/internal/parser/encoding.go +++ b/internal/parser/encoding.go @@ -21,7 +21,7 @@ func EncodePath(path string) string { if path == "" { return "" } - encoded := strings.ReplaceAll(path, "/", "-") + encoded := strings.NewReplacer("/", "-", "\\", "-").Replace(path) if strings.HasPrefix(encoded, "-") { return encoded[1:] } diff --git a/internal/parser/encoding_extra_test.go b/internal/parser/encoding_extra_test.go index 561eb2d..772102e 100644 --- a/internal/parser/encoding_extra_test.go +++ b/internal/parser/encoding_extra_test.go @@ -99,6 +99,7 @@ func TestEncodePath(t *testing.T) { {"/home/user/app", "home-user-app"}, {"", ""}, {"relative/path", "relative-path"}, + {`C:\Users\jc\Desktop\project`, "C:-Users-jc-Desktop-project"}, } for _, tt := range tests {