Skip to content

Bug report: href() and escaped periods don't work together #13795

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
wants to merge 3 commits into from

Conversation

ngbrown
Copy link
Contributor

@ngbrown ngbrown commented Jun 12, 2025

This pull request updates the bug-report-test.ts to show a failure when using href() on paths that contain an escaped period.

I also updated packages\react-router\__tests__\href-test.ts with a failing test.

I'm using the file route conventions (fs-routes). A route that starts out like this: app\routes\text.$id[.txt].ts is turned into a page string of "/text/:id.txt" by react-router typegen.

This means that this is the only type correct way to use href() is:

href("/text/:id.txt", { id: "a123" })

But the output string is incorrect, as it is only: /text/a123, not /text/a123.txt.

A repository with essentially the same project as the test is available here: https://github.com/ngbrown/react-router-href-with-period

Using something like route("text/:id.txt", "routes/text-file.ts") also works for the routing portion, but doesn't change anything for the href() issue.

I'm not sure on the direction of the fix... whether the team want to change just href() or to also change the pages strings.

@ngbrown ngbrown force-pushed the href-with-period branch from 751b529 to 42c7017 Compare June 12, 2025 19:08
Copy link

changeset-bot bot commented Jun 12, 2025

⚠️ No Changeset found

Latest commit: 42c7017

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jun 12, 2025

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@ngbrown
Copy link
Contributor Author

ngbrown commented Jun 12, 2025

I was following the bug reporting process to open this PR, but I now have a possible fix. What should I do next?

My fix is at: https://github.com/ngbrown/react-router/tree/href-with-period-fix (view diff)

@timdorr
Copy link
Member

timdorr commented Jun 13, 2025

Easiest thing would be to close this out and open a new PR.

@ngbrown
Copy link
Contributor Author

ngbrown commented Jun 13, 2025

@timdorr Thanks. I opened a new PR at #13797.

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.

2 participants