Skip to content

Fix double slash normalization for useNavigate paths with colons#14718

Merged
brophdawg11 merged 2 commits intodevfrom
brophdawg11/double-slash-fix
Jan 16, 2026
Merged

Fix double slash normalization for useNavigate paths with colons#14718
brophdawg11 merged 2 commits intodevfrom
brophdawg11/double-slash-fix

Conversation

@brophdawg11
Copy link
Contributor

@brophdawg11 brophdawg11 commented Jan 9, 2026

Closes #14711

This is a rework of the solution from #14529 that removes the absolute path check because resolvePath doesn't need to handle absolute URLs.

@changeset-bot
Copy link

changeset-bot bot commented Jan 9, 2026

🦋 Changeset detected

Latest commit: 0571de6

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

if (toPathname) {
if (isAbsoluteUrl(toPathname)) {
pathname = toPathname;
toPathname = toPathname.replace(/\/\/+/g, "/");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't need to be checking for absolute URLs at all here before. resolvePath is only intended to manage pathnames/search/hash - absolute navigations are handled outside of here by Link so we can just always do the double slash replacement here.

@brophdawg11 brophdawg11 merged commit 3a5b5ad into dev Jan 16, 2026
5 checks passed
@brophdawg11 brophdawg11 deleted the brophdawg11/double-slash-fix branch January 16, 2026 16:16
@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version 7.13.0-pre.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version 7.13.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

edmundhung pushed a commit to edmundhung/react-router that referenced this pull request Jan 27, 2026
…emix-run#14718)

* Fix double slash normalization or useNavigate colon paths

* Add test
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.

v7.9.6 Breaking Change: When using a colon in navigation, must precede relative paths with ./

1 participant