Skip to content

Commit

Permalink
fix(rollapp): metadata URL validation (#1667)
Browse files Browse the repository at this point in the history
  • Loading branch information
zale144 authored Dec 19, 2024
1 parent 68fd99d commit 3395842
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
19 changes: 9 additions & 10 deletions x/rollapp/keeper/msg_server_update_rollapp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,15 @@ func (s *RollappTestSuite) TestUpdateRollapp() {
},
expError: gerrc.ErrInvalidArgument,
},
// FIXME: URL validation not working as expected?
// {
// name: "invalid metadata",
// update: &types.MsgUpdateRollappInformation{
// Owner: alice,
// RollappId: rollappId,
// Metadata: &types.RollappMetadata{X: "not-url"},
// },
// expError: gerrc.ErrInvalidArgument,
// },
{
name: "invalid metadata",
update: &types.MsgUpdateRollappInformation{
Owner: alice,
RollappId: rollappId,
Metadata: &types.RollappMetadata{X: "not-url"},
},
expError: gerrc.ErrInvalidArgument,
},
}

for _, tc := range tests {
Expand Down
3 changes: 2 additions & 1 deletion x/rollapp/types/rollapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

errorsmod "cosmossdk.io/errors"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/dymensionxyz/dymension/v3/testutil/sample"
)

Expand Down Expand Up @@ -296,7 +297,7 @@ func validateURL(urlStr string) error {
return fmt.Errorf("URL exceeds maximum length")
}

if _, err := url.Parse(urlStr); err != nil {
if _, err := url.ParseRequestURI(urlStr); err != nil {
return fmt.Errorf("invalid URL: %w", err)
}

Expand Down

0 comments on commit 3395842

Please sign in to comment.