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

[4.6] do not overencode unhashed states #9752

Merged
merged 1 commit into from
Jan 5, 2017

Conversation

kobelb
Copy link
Contributor

@kobelb kobelb commented Jan 5, 2017

Backports #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 [4.6] do not overencode unhashed states Jan 5, 2017
Copy link
Contributor

@stacey-gammon stacey-gammon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes match what was in the original backport. Wonder why jasper couldn't handler this seamlessly.

lgtm

@kobelb kobelb removed the review label Jan 5, 2017
@kobelb kobelb merged commit 4f213eb into elastic:4.6 Jan 5, 2017
@kobelb kobelb deleted the backport-4.6-8212 branch January 5, 2017 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants