Skip to content

fix(react-router): fix regex handling for URLs containing newline characters #13901

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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

rururux
Copy link

@rururux rururux commented Jun 28, 2025

fixes: #13490

Currently, with the implementation of compilePath, routes like /* do not match when the URL starts with a newline character (%0A).
This is because the regular expression generated in the compilePath function does not have the s (single line) flag set.
This PR adds the s flag to the regular expression used for route matching and includes test cases to verify the behavior.

Copy link

changeset-bot bot commented Jun 28, 2025

🦋 Changeset detected

Latest commit: eaa5b5c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
react-router Patch
@react-router/architect Patch
@react-router/cloudflare Patch
@react-router/dev Patch
react-router-dom Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
create-react-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rururux rururux changed the title fix regex handling for URLs containing newline characters fix(react-router): fix regex handling for URLs containing newline characters Jun 28, 2025
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.

URL Parsing Error Due to Newline Character Inclusion
2 participants