8000 URL parameters are re-encoded when aborting a transition · Issue #760 · vuejs/vue-router · GitHub
[go: up one dir, main page]

Skip to content

URL parameters are re-encoded when aborting a transition #760

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

Closed
dfmelicor opened this issue Oct 12, 2016 &middo 8000 t; 12 comments
Closed

URL parameters are re-encoded when aborting a transition #760

dfmelicor opened this issue Oct 12, 2016 · 12 comments

Comments

@dfmelicor
Copy link

If any parameter contains a URL encoded value, the value is re-encoded when the transition is aborted.

If the current URL is http://website.com/#!/accounts?PARAM=%20, calling transition#abort redirects to http://website.com/#!/accounts?PARAM=%25%20 instead of the original URL.

Checking transition#abort, it seems the call to #stringifyPath performs the double encoding when a String parameter is passed.

@LinusBorg
Copy link
Member
LinusBorg commented Oct 12, 2016

Hi @dfmelicor

Thanks for filing this issue! Could you please provide a small reporduction on jsfiddle so we can debug this without trying to replicate this ourselves?`

That would be very helpful, thanks!

@dfmelicor
Copy link
Author

Hi @LinusBorg

Please see: https://jsfiddle.net/dfmelicor/ehgtkpa2/2/

You can click Navigate to go to a random link. Ticking the Abort Transition checkbox before clicking Navigate reproduces the problem.

It seems to be replicable using the following versions:

  • Vue 1.0.28
  • Vue Router 0.7.13

Thank you!

@LinusBorg
Copy link
Member

Thanks for the fiddle.

We will take care of this.

@dfmelicor
Copy link
Author

Thank you!

Appreciate all the work you guys are doing.

@LinusBorg LinusBorg self-assigned this Oct 19, 2016
@LinusBorg
Copy link
Member

Will send PR tomorrow.

@BreakingDev
Copy link

@LinusBorg Any update on this?

8000
@LinusBorg
Copy link
Member

Dang, totally forgot about this one. Hope I have time to push this tonight, if not it has to wait until the weekend.

@LinusBorg
Copy link
Member

Finally came around to making this PR

@LinusBorg LinusBorg removed their assignment Dec 14, 2016
yyx990803 pushed a commit that referenced this issue Jan 16, 2017
* init commit

* add comment explaining the change.
@dfmelicor
Copy link
Author

@LinusBorg Will a new build of vue-router be created to include this change? Or we should just build on our own?

@LinusBorg
Copy link
Member
LinusBorg commented Jan 25, 2017

We will surely release a new version of the 0.7 branch which includes this fix.

We will have to ask @yyx990803 about the timeline though.

@dfmelicor
Copy link
Author

@LinusBorg Got it. Looking forward to the next release.

@dfmelicor
Copy link
Author

@LinusBorg We're trying out the fix now, but encountering a different problem with encoding. Colons and slashes don't seem to be encoded after the abort.

e.g.:
Original URL, where PARAM = :

http://example.com/!#/path?PARAM=%3A

It is expected that on abort, URL remains unchanged. But the actual behavior is, the URL now becomes

http://example.com/!#/path?PARAM=:

I think the problem is with the ff. call in RouteTransition#abort

const path = this.from.path ? tryDecode(this.from.path, true) : '/'

Shouldn't the second parameter be false?

@posva posva closed this as completed Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0