Skip to content

Commit

Permalink
fix(url-sync): always decode incoming query string
Browse files Browse the repository at this point in the history
Issue: we decided not to put encoded URIS inside the url bar because
it looks very bad (%23.. everywhere) since we are using things like
"&nR[popularity][>=][0]=0".

But then, when copy pasting a URL with "&nR[popularity][>=][0]=0"
things gets messy: GUI clients

As for copy pasting the url from the urlbar or right click a link and
copy from the context menu then paste it anywhere => it's the
responsibility of the pasted-to client to do things well (escape, make
it clickable).

But then, on our side, we can be sent encoded URIs, so we need to
decode them first before passing them to the helper.

This should be harmless. What do you think?

fixes #848
  • Loading branch information
vvo committed Mar 2, 2016
1 parent 6dc4bb5 commit bea38e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/url-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ let hashUrlUtils = {
return document.location.search + this.character + qs;
},
readUrl: function() {
return window.location.hash.slice(1);
return decodeURIComponent(window.location.hash.slice(1));
}
};

Expand All @@ -68,7 +68,7 @@ let modernUrlUtils = {
return this.character + qs + document.location.hash;
},
readUrl: function() {
return window.location.search.slice(1);
return decodeURIComponent(window.location.search.slice(1));
}
};

Expand Down

0 comments on commit bea38e3

Please sign in to comment.