Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

iron-location's this.hash is encoded and decoded using different funcitons #124

Open
dspattison-google opened this issue Feb 13, 2019 · 1 comment

Comments

@dspattison-google
Copy link

Description

this.hash should use the same encoding and decoding functions. encodeURI and encodeURIComponent have subtle differences.

https://github.com/PolymerElements/iron-location/blob/master/iron-location.js#L88
window.decodeURIComponent(window.location.hash.slice(1));

https://github.com/PolymerElements/iron-location/blob/master/iron-location.js#L210
partiallyEncodedHash = '#' + window.encodeURI(this.hash);

encodeURI and encodeURIComponent maybe the wrong function to encode/decode the hash, but i am just advocating for using the same function... not necessarily the correct one.

@danielvanmil
Copy link

why are the fragments decoded anyway? I can't seem to use a identifier with slashes for example with a url like http://localhost#/%2Fmy%2Fpath with the use-hash-as-path option as the fragment is decoded to //my/path

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants