fix: downloading github url with / in branch name#430
fix: downloading github url with / in branch name#430cwyl02 wants to merge 1 commit intohashicorp:mainfrom
Conversation
|
Hi @claire-labry @picatz @nywilken, please take a look. We use go-getter internally and merging this will fix #422 thus help getting our internal CI passing. |
|
also curious if |
|
any updates on this PR? |
CreatorHead
left a comment
There was a problem hiding this comment.
Thanks for working on this, the overall approach makes sense.
Splitting the source on ? before path parsing correctly fixes the issue where / inside query parameters (e.g. branch names like feature/foo) were being misinterpreted as part of the repo path.
I have one small concern before merging:
Handling multiple ? characters
Right now the code errors if strings.Split(src, "?") results in more than two parts. In practice, only the first ? is a delimiter in a URL; additional ? characters can legally appear inside the query string as data. Previously, these cases would likely have worked, so this introduces a stricter behavior than before.
Would it make sense to switch to strings.SplitN(src, "?", 2) and drop the len(parts) > 2 check? That would preserve the fix while avoiding a potential regression.
Tests
The added test is helpful. It would be great to also include a case that mirrors the original failure more directly, e.g. a URL with ref=feature/foo (optionally with a subdirectory as well), to clearly lock in the intended behavior.
With those tweaks, I think this change would be in good shape to merge.
This fixes #422