hashicorp / go-getter

Package for downloading things from a string URL using a variety of protocols.
Mozilla Public License 2.0
1.66k stars 239 forks source link

Incorect handling of slashes in git refs #469

Open denis256 opened 10 months ago

denis256 commented 10 months ago

Noticed that go-getter handles incorrectly git paths which have slashes in ref parameter

Example:

# go-getter 1.7.3
$ go-getter "github.com/denis256/terraform-test-module.git//modules/test-file?ref=master" /tmp/test/ 
2024/01/22 17:16:09 success!

$ go-getter "github.com/denis256/terraform-test-module.git//modules/test-file?ref=team/ABC-1234-component" /tmp/test/ 
2024/01/22 17:18:19 Error downloading: error downloading 'https://github.com/denis256/terraform-test-module.git?ref=team': /usr/bin/git exited with 1: error: pathspec 'team' did not match any file(s) known to git

Looks like it is attempted to get https://github.com/denis256/terraform-test-module.git?ref=team instead of ref=team/ABC-1234-component