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

[BUGIX release] [Fixes #14925] remove duplicate / in pathname #14961

Merged
merged 1 commit into from
Apr 5, 2017

Conversation

stefanpenner
Copy link
Member

@stefanpenner stefanpenner commented Feb 25, 2017

[Fixes #14925]

This avoids a DOMException, which interprets duplicate / as a security violation and prevents the associated history state modifications.

error in question:
screen shot 2017-02-24 at 11 32 53 pm


I'm not totally sure this is the appropriate fix, so maybe someone else should sanity check this one.

@krisselden
Copy link
Contributor

@stefanpenner is this a regression? does this happen when there are multiple epsilon segments?

@stefanpenner
Copy link
Member Author

stefanpenner commented Feb 25, 2017

@stefanpenner is this a regression?

I don't believe it is a regression, rather browsers hard-error (but in the past they did not).

does this happen when there are multiple epsilon segments?

I'm not totally sure. Is your question if we should only strip some excess / not all? As far as i can tell it is just <host>/ vs <host>// vs <host>/// but <host>/foo// fails sooner and with UnrecognizedURLError.

Which lead me to believe we may just want to strip unwanted / automatically. Although I could imagine there are issues with that, I can't think of those may be. Admittedly I am not really sure, so advice/suggestions would be good.

@stefanpenner
Copy link
Member Author

Chatting with @krisselden this is more likely an issue in RR not collapsing these "epsilon" segments.

@stefanpenner
Copy link
Member Author

Actually. This appears to be unrelated to RR (route recognizer), and should be thought of as more of a "cleanup" of user input (from location.pathname)

@scalvert
Copy link
Contributor

scalvert commented Mar 8, 2017

👍

@@ -101,7 +101,8 @@ export default EmberObject.extend({
// remove baseURL and rootURL from start of path
let url = path
.replace(new RegExp(`^${baseURL}(?=/|$)`), '')
.replace(new RegExp(`^${rootURL}(?=/|$)`), '');
.replace(new RegExp(`^${rootURL}(?=/|$)`), '')
.replace(/\/\//g,'/'); // remove extra slashes
Copy link
Member

Choose a reason for hiding this comment

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

Should this be anchored? If not, can you add a test showing that something like /foo//bar/ is actually supported?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm open to suggestions, I can glady add that test, or anchor it. thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

lets just anchor at the end, we can always make it more permissive if we end up finding a need for it...

Copy link
Member Author

Choose a reason for hiding this comment

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

sounds good

This avoids a DOMException, which interprets duplicate `/` as a security violation and prevents the associated history state modifications.
@stefanpenner
Copy link
Member Author

Updated as per @rwjblue's comment. We should be good to go if CI agrees.

@stefanpenner stefanpenner merged commit 08a6719 into master Apr 5, 2017
@stefanpenner stefanpenner deleted the duplicate-slashes branch April 5, 2017 17:53
@stefanpenner
Copy link
Member Author

@rwjblue should I backport or are you? I don't want to confuse the "process".

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.

Ember 2.11 double forward slash causes application to break
4 participants