vercel / next.js

The React Framework
https://nextjs.org
MIT License
124.26k stars 26.48k forks source link

Redirects: `destination` has segments not in `source` #24769

Open Aviortheking opened 3 years ago

Aviortheking commented 3 years ago

What version of Next.js are you using?

10.2.0

What version of Node.js are you using?

14.15.4

What browser are you using?

not related

What operating system are you using?

Windows

How are you deploying your application?

next dev

Describe the Bug

I am building some redirects for my website and idk why but it seems not to support when I use ( or ) in the destination url It doesn't change if I add \\( or if it's only ( ex

`destination` has segments not in `source` or `has` (0) for route {"source":"/database/:serie/tk-sm-r/:path*","destination":"/database/:serie/SM-Kit-du-dresseur-\\(Raichu-d'Alola\\)/:path*","permanent":true}

Expected Behavior

it should not be exit with an error

To Reproduce

in a next.config.js add redirects with this value

{"source":"/database/:serie/tk-sm-r/:path*","destination":"/database/:serie/SM-Kit-du-dresseur-\\(Raichu-d'Alola\\)/:path*","permanent":true}

or this

{"source":"/database/:serie/tk-sm-r/:path*","destination":"/database/:serie/SM-Kit-du-dresseur-(Raichu-d'Alola)/:path*","permanent":true}
jankaifer commented 1 year ago

Reproduced in next@13 https://github.com/JanKaifer/next-repro-24769

jankaifer commented 1 year ago

workaround here: https://github.com/vercel/next.js/issues/25520#issuecomment-1105688252