Skip to content

Commit

Permalink
fix(upgrade): Stop treating inline JSON as a URL
Browse files Browse the repository at this point in the history
Fix #19686
  • Loading branch information
gibson042 committed Mar 8, 2024
1 parent 28801fc commit cc83347
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion x/upgrade/plan/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func ParseInfo(infoStr string, opts ...ParseOption) (*Info, error) {
}

// If it's a url, download it and treat the result as the real info.
if _, err := neturl.Parse(infoStr); err == nil {
if _, err := neturl.ParseRequestURI(infoStr); err == nil {
if err := ValidateURL(infoStr, parseConfig.EnforceChecksum); err != nil {
return nil, err
}
Expand Down
6 changes: 6 additions & 0 deletions x/upgrade/plan/info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ func (s *InfoTestSuite) TestParseInfo() {
expectedInfo: nil,
expectedInError: []string{"plan info must not be blank"},
},
{
name: "empty JSON",
infoStrMaker: makeInfoStrFuncString("{}"),
expectedInfo: &Info{},
expectedInError: nil,
},
{
name: "json binaries is wrong data type",
infoStrMaker: makeInfoStrFuncString(binariesWrongJSON),
Expand Down

0 comments on commit cc83347

Please sign in to comment.