Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/command/hook_module_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ func (h uiModuleInstallHooks) Install(modulePath string, v *version.Version, loc
func (h uiModuleInstallHooks) log(message string) {
switch h.View.(type) {
case view:
h.View.Log(message)
// there is no unformatted option for the View interface, so we need to
// pass message as a parameter to avoid double escaping % characters
h.View.Log("%s", message)
default:
h.Ui.Info(message)
}
Expand Down
3 changes: 3 additions & 0 deletions internal/getmodules/moduleaddrs/detect_git.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ func detectGitHub(src string) (string, bool, error) {
}

if strings.HasPrefix(src, "github.com/") {
src, rawQuery, _ := strings.Cut(src, "?")

parts := strings.Split(src, "/")
if len(parts) < 3 {
return "", false, fmt.Errorf(
Expand All @@ -51,6 +53,7 @@ func detectGitHub(src string) (string, bool, error) {
if err != nil {
return "", true, fmt.Errorf("error parsing GitHub URL: %s", err)
}
url.RawQuery = rawQuery

if !strings.HasSuffix(url.Path, ".git") {
url.Path += ".git"
Expand Down
4 changes: 4 additions & 0 deletions internal/getmodules/moduleaddrs/detect_git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ func TestDetectGitHub(t *testing.T) {
"github.com/hashicorp/foo.git?foo=bar",
"git::https://github.com/hashicorp/foo.git?foo=bar",
},
{
"github.com/hashicorp/foo.git?foo=bar/baz",
"git::https://github.com/hashicorp/foo.git?foo=bar/baz",
},
})
}

Expand Down