-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
next/link treats initial dot incorrectly #33081
Labels
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
Comments
balazsorban44
added
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
kind: bug
and removed
bug
Issue was opened via the bug report template.
labels
Jan 7, 2022
10 tasks
3 tasks
SukkaW
added a commit
to SukkaW/next.js
that referenced
this issue
May 11, 2022
3 tasks
kodiakhq bot
pushed a commit
that referenced
this issue
May 22, 2022
## Bug - [x] Related issues linked using `fixes #number` - [x] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` Fixes #36823 Closes #33084 The issue is caused by the `isLocalURL` function only checks if a URL starts with `/`, `#` or `?`. So a URL that starts with `.` will not be considered a "local URL". The PR fixes that by introducing a new util function `isAbsoluteUrl` that is fully compliant with [RFC3986](https://tools.ietf.org/html/rfc3986#section-4.3).
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Run
next info
(available from version 12.0.8 and up)What version of Next.js are you using?
12.0.7
What version of Node.js are you using?
16.0.0
What browser are you using?
Chrome
What operating system are you using?
Windows 10
How are you deploying your application?
Only local project for now
Describe the Bug
At a page like https://www.example.com/suburl/
Using standard html syntax to link to a sub path
<Link href="./path/"><a href="./path/">a</a></Link>
next/link sends the user to the wrong url: example.com/path/ - it skips the dot which should be the current path.Seems like it should be supported based on: #614
Expected Behavior
The link should lead to: https://www.example.com/suburl/path/ .
If you disable js in the browser you get the correct native bahavior of course.
To Reproduce
At a page like https://www.example.com/suburl/
next.config.mjs:
In a component:
The text was updated successfully, but these errors were encountered: