Skip to content

Commit

Permalink
decode hex value when getting url
Browse files Browse the repository at this point in the history
  • Loading branch information
robdefeo committed Jul 20, 2019
1 parent 9641b4b commit 8c3637e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/envelope/0x01.go
Expand Up @@ -55,14 +55,15 @@ func (d *ZeroX01) URL(decrypter cipher.Decrypter) (*url.URL, error) {
if err != nil {
return nil, errors.WithStack(err)
}

loc, ok := MLIToAddress()[code]
if !ok {
return nil, errors.Errorf("unknown location code %q", code)
}
return url.Parse(strings.Join(
[]string{
loc,
string(hash),
hex.EncodeToString(hash),
},
"/"))
}
Expand Down
2 changes: 1 addition & 1 deletion internal/envelope/0x01_test.go
Expand Up @@ -47,7 +47,7 @@ func TestZeroX01_URL(t *testing.T) {
}(),
},
func() *url.URL {
u, _ := url.Parse("https://mcx.mx/value")
u, _ := url.Parse("https://mcx.mx/76616c7565")
return u
}(),
false,
Expand Down

0 comments on commit 8c3637e

Please sign in to comment.