Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[backport] PR #8212 to 5.0 - do not overencode unhashed states #8217

Merged
merged 1 commit into from
Sep 10, 2016

Conversation

elastic-jasper
Copy link
Contributor

Backport PR #8212

Commit 1:
[state/unhashUrl] use encode-uri-query to generate cleanly encoded urls

By default, the url.format function stringifies the query object and encodes each parameter with encodeURIComponent(). This is effective, but does not match the native browser behavior, which is to only encode the non-pchar characters as defined by rfc3986. Because of this, angular's $location.search() function uses a function internally called encodeUriQuery() to mimic the browser behavior before updating location.href.

To bring the same funtionality to the unhashUrl() function, the encodeUriQuery() was extracted into it's own package and used as the escape handler for querystring.stringify()

---------

**Commit 1:**
[state/unhashUrl] use encode-uri-query to generate cleanly encoded urls

By default, the url.format function stringifies the query object and encodes each parameter with `encodeURIComponent()`. This is effective, but does not match the native browser behavior, which is to only encode the non-`pchar` characters as defined by [rfc3986][1]. Because of this, angular's `$location.search()` function uses a function internally called `encodeUriQuery()` to mimic the browser behavior before updating `location.href`.

To bring the same funtionality to the `unhashUrl()` function, the `encodeUriQuery()` was extracted into it's own package and used as the escape handler for `querystring.stringify()`

[1]: https://www.ietf.org/rfc/rfc3986.txt

* Original sha: d9dac3f
* Authored by spalger <spalger@users.noreply.github.com> on 2016-09-09T22:39:57Z
@epixa epixa changed the title [backport] PR #8212 to 5.0 [backport] PR #8212 to 5.0 - do not overencode unhashed states Sep 10, 2016
@epixa epixa merged commit 9ffe9bb into 5.0 Sep 10, 2016
@epixa epixa deleted the jasper/backport/8212/5.0 branch September 10, 2016 13:30
alexwizp added a commit to alexwizp/kibana that referenced this pull request Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants