Skip to content

fix: keep "/" in GitHub git references - #76

Merged
ehennestad merged 2 commits into
mainfrom
parse-github-refs-containing-slashes
Oct 16, 2026
Merged

ehennestad merged 2 commits into
mainfrom
parse-github-refs-containing-slashes

Conversation

@ehennestad

Copy link
Copy Markdown
Owner

parseRepositoryURL read the git reference from the path segment that holds the repository name. A reference containing "/" was cut at the first "/", so https://github.com/<owner>/<repo>@release/1.0 gave the reference release. vendorPackage then requested the wrong reference from GitHub: a 404 if release does not exist, or the wrong code if it does.

The reference is now everything after the first "@", up to the end of the path. git allows both "/" and "@" in reference names. A trailing "/" is dropped.

installFromSourceUri had its own parser for the same URL form. It split the URI at every "@", so a reference a@b gave a, and it passed URLs such as .../tree/main on unchanged, which produced an invalid archive URL. It now calls parseRepositoryURL and rebuilds the repository URL from the owner and repository name. Its local parseGitHubSourceUri is removed.

A URL with path segments after the repository name and no "@", such as https://github.com/<owner>/<repo>/tree/dev, now raises MATBOX:GitHub:InvalidRepositoryURL. Ignoring the segments would install the default branch instead of the branch in the URL.

GitHub resolves a reference containing "/" in both the commits API (repos/<owner>/<repo>/commits/<ref>) and the archive download (<repo>/archive/<ref>.zip), so the URLs built from the reference are unchanged.

Not covered here: installGithubRepository names the installed folder <repo>-<ref>, which is a nested path when the reference contains "/". That is handled in a separate PR.

🤖 Generated with Claude Code

parseRepositoryURL read the reference from the path segment that holds
the repository name, so a branch such as "release/1.0" came back as
"release". vendorPackage then asked GitHub for the wrong reference. The
reference is now everything after the first "@", up to the end of the
path. git allows both "/" and "@" in reference names.

installFromSourceUri had its own parser for the same URL form. It split
the whole URI at every "@", so "a@b" came back as "a", and it passed
URLs such as ".../tree/main" on unchanged, which made the archive URL
invalid. It now calls parseRepositoryURL and rebuilds the repository
URL from the owner and the repository name.

A URL with path segments after the repository name and no "@" is now
an error (MATBOX:GitHub:InvalidRepositoryURL). Ignoring the segments
would install the default branch instead of the branch in the URL.

GitHub resolves a reference containing "/" in both the commits API
(repos/<owner>/<repo>/commits/<ref>) and the archive download
(<repo>/archive/<ref>.zip), so the URLs built from the reference are
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

88 tests   88 ✅  36s ⏱️
 7 suites   0 💤
 1 files     0 ❌

Results for commit 1366b20.

♻️ This comment has been updated with latest results.

@ehennestad
ehennestad merged commit 6713d0f into main Oct 16, 2026
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.

1 participant