Skip to content

fix(install): keep file:// URLs slash-form on Windows - #346

Merged
runkids merged 1 commit into
runkids:mainfrom
star-nebula:fix/install-file-url-on-windows
Oct 3, 2026
Merged

runkids merged 1 commit into
runkids:mainfrom
star-nebula:fix/install-file-url-on-windows

Conversation

@star-nebula

Copy link
Copy Markdown
Contributor

What

parseFileURL cleaned the path and then prefixed it with file://:

path := filepath.Clean(matches[1])
source.CloneURL = "file://" + path

filepath.Clean rewrites separators for the local OS, so on Windows a file:// URL is turned
inside out — a URL is slash-form on every platform, but the code emits the OS-native form:

input Linux CloneURL Windows CloneURL (before)
file:///path/to/repo file:///path/to/repo file://\path\to\repo
file:///C:/repos/skills n/a file://\C:\repos\skills

git does not accept either Windows form as a local repository, so install/add from a local
path — the workflow #269 and #264 reported — fails on the platform that ships binaries.
Part of #344.

Fix

filepath.ToSlash on the cleaned path. The cleaned value is still used for everything local,
only the URL rendering changes, so Unix output is byte-identical.

Tests

New table case file url with a drive path keeps URL separators pins the URL form. On a
windows/amd64 build of ./internal/install:

  • stock 7043ca3a: --- FAIL: TestParseSource_FileURL (CloneURL = file://\path\to\repo)
  • with this commit: that test passes, and Linux is unchanged

The package still has Windows-specific failures this commit does not touch (e.g.
TestCopyDir_PreservesPermissions, which asserts POSIX mode bits), so it is not claimed green.

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.
@runkids

runkids commented Oct 3, 2026

Copy link
Copy Markdown
Owner

@codex review

@runkids

runkids commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Thanks! One note for the record: local directory installs (#269) go through parseLocalPath, not parseFileURL, so this fixes explicit file:// sources only and #269 stays open.

@runkids
runkids merged commit 95f54f2 into runkids:main Oct 3, 2026
7 checks passed
@star-nebula
star-nebula deleted the fix/install-file-url-on-windows branch October 3, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants