fix(x/upgrade): Stop treating inline JSON as a URL (backport #19706) (#19767)

Co-authored-by: Richard Gibson <richard.gibson@gmail.com>
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
This commit is contained in:
mergify[bot] 2024-03-18 12:46:45 +00:00 committed by GitHub
parent 9a59234c42
commit 0df29024da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 1 deletions

View File

@ -25,6 +25,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
## [Unreleased]
### Bug Fixes
* [#19706](https://github.com/cosmos/cosmos-sdk/pull/19706) Stop treating inline JSON as a URL.
## [v0.1.1](https://github.com/cosmos/cosmos-sdk/releases/tag/x/upgrade/v0.1.1) - 2023-12-11
### Improvements

View File

@ -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
}

View File

@ -74,6 +74,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),