Skip to content

Fix double slash normalization for useNavigate paths with colons - #14718

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

brophdawg11 merged 2 commits into
devfrom
brophdawg11/double-slash-fix

Conversation

@brophdawg11

@brophdawg11 brophdawg11 commented Jan 9, 2026 •

Copy link
Copy Markdown
Contributor

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

changeset-bot Bot commented Jan 9, 2026 •

Copy link
Copy Markdown

🦋 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
Copy Markdown
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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is it intended that navigate("https://<absolute path>") doesn't work now? because it used to work before this change and it was a breaking change for us.

@vincerubinetti vincerubinetti May 6, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same, this was surprising, especially since it's not mentioned anywhere in the changelog or docs.

To be clear, I think it makes sense that it wouldn't handle absolute links. But this is definitely a breaking change that should've been noted somewhere.

@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
Copy Markdown
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
Copy Markdown
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!

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 ./

3 participants