From 95f54f233c87e2132fd9c88863eb90f974c36b60 Mon Sep 17 00:00:00 2001 From: star-nebula <105629895+star-nebula@users.noreply.github.com> Date: Sat, 3 Oct 2026 12:53:34 +0800 Subject: [PATCH] fix(install): keep file:// URLs slash-form on Windows (#346) parseFileURL cleaned the path with filepath.Clean before prefixing it with `file://`, and on Windows Clean rewrites the separators, so `ss install file:///C:/repos/skills` handed git `file://\C:\repos\skills` and the clone failed. The URL form is slash-based on every platform; only the local-path branches need OS separators. Convert back with filepath.ToSlash and pin the shape with a drive-letter case in the existing table, which fails on Windows without the change and is inert on Unix. --- internal/install/source.go | 5 ++++- internal/install/source_test.go | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/install/source.go b/internal/install/source.go index ba39c099a..6c61ca431 100644 --- a/internal/install/source.go +++ b/internal/install/source.go @@ -559,7 +559,10 @@ func parseFileURL(matches []string, source *Source) (*Source, error) { } source.Type = SourceTypeGitHTTPS // Treat as git for cloning - source.CloneURL = "file://" + path + // filepath.Clean rewrites the separators for the local OS, but a file:// URL + // keeps forward slashes everywhere; on Windows the raw path would produce + // `file://\path\to\repo`, which git does not accept as a local repository. + source.CloneURL = "file://" + filepath.ToSlash(path) if err := validateCloneURL(source.CloneURL); err != nil { return nil, err diff --git a/internal/install/source_test.go b/internal/install/source_test.go index 1dca2003f..59747865b 100644 --- a/internal/install/source_test.go +++ b/internal/install/source_test.go @@ -595,6 +595,13 @@ func TestParseSource_FileURL(t *testing.T) { wantCloneURL: "file:///path/to/repo", wantName: "repo", }, + { + // On Windows filepath.Clean would otherwise emit `file://\C:\...`. + name: "file url with a drive path keeps URL separators", + input: "file:///C:/path/to/repo", + wantCloneURL: "file:///C:/path/to/repo", + wantName: "repo", + }, { name: "file url with dot suffix normalized to root", input: "file:///path/to/repo/.",