remix-run / react-router

Declarative routing for React
https://reactrouter.com
MIT License
53.11k stars 10.31k forks source link

[Bug]: Absolute URL detection is too aggressive (breaking change from 6.8.0->6.8.1) #11291

Open janruo opened 8 months ago

janruo commented 8 months ago

What version of React Router are you using?

6.27.0

Steps to Reproduce

Render a Link with a value containing colons: <Link to="foo:bar" />

Expected Behavior

Colon is an allowed character in URL paths, according to rfc3986. (For example, Wikipedia uses them extensively.)

v6.8.0 is the last version which respects that, and renders an internal route link when given a to value containing colons.

Actual Behavior

v6.8.1 and later treats any to value with colons as an absolute URL and renders an external link.

This change seems to be the original cause: https://github.com/remix-run/react-router/pull/9994

janruo commented 1 week ago

@timdorr @brophdawg11 Any thoughts about this, since you approved the change?

<Link> has the relative prop, but it doesn't help. The absolute detection runs first and the prop is ignored.