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

NavLink fails on urls with special characters in them. #6020

Closed
codeviking opened this issue Mar 16, 2018 · 1 comment
Closed

NavLink fails on urls with special characters in them. #6020

codeviking opened this issue Mar 16, 2018 · 1 comment

Comments

@codeviking
Copy link

Appears to impact react-router versions 4 and above.

Test Case

https://codepen.io/thecodeviking/pen/KogaJR

Steps to reproduce

  1. Create a <NavLink />.
  2. Set the to to a value that includes (*).
  3. Notice that things don't render as expected.

Expected Behavior

To see a nice, shiny <NavLink />!

Actual Behavior

An exception is thrown:

react-router-dom.js:4100 Uncaught SyntaxError: Invalid regular expression: /^\/paper\/Extended-Symptom-Code-((?:*))-the-Extended-Sympto\/1(?:\/(?=$))?(?=\/|$)/: Nothing to repeat
    at new RegExp (<anonymous>)
    at tokensToRegExp (VM3961 react-router-dom.js:4100)
    at stringToRegexp (VM3961 react-router-dom.js:4028)
    at pathToRegexp (VM3961 react-router-dom.js:4131)
    at compilePath (VM3961 react-router-dom.js:4150)
    at matchPath (VM3961 react-router-dom.js:4179)
    at Route.computeMatch (VM3961 react-router-dom.js:4285)
    at new Route (VM3961 react-router-dom.js:4254)
    at constructClassInstance (VM3960 react-dom.development.js:6897)
    at updateClassComponent (VM3960 react-dom.development.js:8381)
@timdorr
Copy link
Member

timdorr commented Mar 17, 2018

Already fixed in #5596

@timdorr timdorr closed this as completed Mar 17, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018
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