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

Putting a % in a url without proper url encoding crashes React Router Dom #5824

Closed
ginkoid opened this issue Jan 1, 2018 · 2 comments
Closed

Comments

@ginkoid
Copy link

ginkoid commented Jan 1, 2018

Version

4.1.1

Test Case

Go to reacttraining.com/react-router/web/guides/philosophy%, and inspect the error in the browser console.

Steps to reproduce

Go to any site using react-router-dom, and enter an erroneous percent sign somewhere in the URL.

Expected Behavior

React router catches the error from decodeURI, doesn't crash, and continues normally by disregarding the percent sign.

Actual Behavior

React Router does not catch the error, and crashes the entire app, causing it to unmount (even when there are error boundaries).

The error:

PathUtils.js:37: Uncaught URIError: URI malformed
    at decodeURI (<anonymous>)
    at e.parsePath (PathUtils.js:37)
    at x (createBrowserHistory.js:79)
    at g (createBrowserHistory.js:152)
    at new e (BrowserRouter.js:42)
    at p._constructComponentWithoutOwner (ReactCompositeComponent.js:298)
    at p._constructComponent (ReactCompositeComponent.js:285)
    at p.mountComponent (ReactCompositeComponent.js:188)
    at Object.mountComponent (ReactReconciler.js:46)
    at performInitialMount (ReactCompositeComponent.js:371)
@ginkoid ginkoid changed the title Putting a % in a url without proper url encoding crashes React Router Dom. Putting a % in a url without proper url encoding crashes React Router Dom Jan 1, 2018
@timdorr
Copy link
Member

timdorr commented Jan 1, 2018

This is caused by the history library. There is a bug being tracked there: remix-run/history#505

@timdorr timdorr closed this as completed Jan 1, 2018
@ginkoid
Copy link
Author

ginkoid commented Jan 1, 2018

Thank you!

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants