Closed Sekhmet closed 5 years ago
Browsers's URL is not compatible with node's URL. This incompatibility causes steem-uri fail to decode URIs in browser environment.
URL
steem-uri
Node.js:
> new URL('steem://sign/op/WyJ2b3RlIix7InZvdGVyIjoiZm9vIiwiYXV0aG9yIjoiYmFyIiwicGVybWxpbmsiOiJiYXoiLCJ3ZWlnaHQiOjEwMDAwfV0.').host === "sign" true
Chrome/FF:
> new URL('steem://sign/op/WyJ2b3RlIix7InZvdGVyIjoiZm9vIiwiYXV0aG9yIjoiYmFyIiwicGVybWxpbmsiOiJiYXoiLCJ3ZWlnaHQiOjEwMDAwfV0.').host === "sign" false
This way decode can't pass this check: https://github.com/steemit/steem-uri-spec/blob/bf4a5a4a9f3ccc7e651a5086fa316d7fa795147a/src/index.ts#L76-L78
decode
const resp = steemuri.encodeOp(['vote', {voter: 'foo', author: 'bar', permlink: 'baz', weight: 10000}]) steemuri.decode(resp);
Browsers's
URL
is not compatible with node'sURL
. This incompatibility causessteem-uri
fail to decode URIs in browser environment.Node.js:
Chrome/FF:
This way
decode
can't pass this check: https://github.com/steemit/steem-uri-spec/blob/bf4a5a4a9f3ccc7e651a5086fa316d7fa795147a/src/index.ts#L76-L78Failing example