fix relative URL resolution for SCP-style SSH remotes - #109
Open
eugene-nuvacore wants to merge 1 commit into
Open
fix relative URL resolution for SCP-style SSH remotes#109eugene-nuvacore wants to merge 1 commit into
eugene-nuvacore wants to merge 1 commit into
Conversation
urljoin() only handled scheme:// URLs and truly-relative paths. SCP-style remotes (git@host:path), which urllib does not parse as URLs, fell through to plain string concatenation, so a dependency URL of ../dep.git against a base of git@host:group/main.git produced git@host:group/main.git/../dep.git instead of git@host:group/dep.git — leaving git to fail the clone. Detect SCP syntax by git's own rule (a colon before any slash, no scheme://), normalize the ".." within the path, and keep the "host:" prefix so the result stays valid SCP syntax. Also covers the user-less host:path form, which urllib otherwise mis-parses as having a scheme.
Author
|
@c0fec0de please take a look, thanks :) |
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.
urljoin()handlesscheme://URLs and truly-relative paths, but notSCP-style SSH remotes (
git@host:path). Python'surllibdoesn't parsethose as URLs (they have no scheme), so they fell through to plain string
concatenation.
With a manifest whose main repo is cloned over an SCP-style remote, a
dependency URL like
../dep.gitresolves against the basegit@host:group/main.gitto:instead of:
git then fails the clone (the server reports the namespace/path doesn't
exist). SCP-style remotes are git's default for
git@-cloned repos, so thishits anyone using a manifest with relative dependency URLs over SSH without an
explicit
ssh://scheme.The fix is to detect SCP-like syntax using git's own rule — a colon before any slash and no
scheme://— then normalize the..within the path while preserving thehost:prefix, so the result stays valid SCP syntax. This also covers theuser-less
host:pathform, whichurllibotherwise mis-parses as having ascheme (
host).