Repository navigation
fix: keep "/" in GitHub git references - #76
Merged
Merged
Conversation
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>
Contributor
Test Results88 tests 88 ✅ 36s ⏱️ Results for commit 1366b20. ♻️ This comment has been updated with latest results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
parseRepositoryURLread the git reference from the path segment that holds the repository name. A reference containing "/" was cut at the first "/", sohttps://github.com/<owner>/<repo>@release/1.0gave the referencerelease.vendorPackagethen requested the wrong reference from GitHub: a 404 ifreleasedoes 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.
installFromSourceUrihad its own parser for the same URL form. It split the URI at every "@", so a referencea@bgavea, and it passed URLs such as.../tree/mainon unchanged, which produced an invalid archive URL. It now callsparseRepositoryURLand rebuilds the repository URL from the owner and repository name. Its localparseGitHubSourceUriis removed.A URL with path segments after the repository name and no "@", such as
https://github.com/<owner>/<repo>/tree/dev, now raisesMATBOX: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:
installGithubRepositorynames 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