mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
addrs: ModuleSourceRemote.String correctly handles query string in URL
Previously it would append the "subdir" portion onto the query string, producing an invalid result.
This commit is contained in:
@@ -316,10 +316,17 @@ func parseModuleSourceRemote(raw string) (ModuleSourceRemote, error) {
|
||||
func (s ModuleSourceRemote) moduleSource() {}
|
||||
|
||||
func (s ModuleSourceRemote) String() string {
|
||||
base := s.Package.String()
|
||||
|
||||
if s.Subdir != "" {
|
||||
return s.Package.String() + "//" + s.Subdir
|
||||
// Address contains query string
|
||||
if strings.Contains(base, "?") {
|
||||
parts := strings.SplitN(base, "?", 2)
|
||||
return parts[0] + "//" + s.Subdir + "?" + parts[1]
|
||||
}
|
||||
return base + "//" + s.Subdir
|
||||
}
|
||||
return s.Package.String()
|
||||
return base
|
||||
}
|
||||
|
||||
func (s ModuleSourceRemote) ForDisplay() string {
|
||||
|
||||
Reference in New Issue
Block a user