NcRichText: links to other pages of the instance become app routes
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- frontend
Research direction
Start by reading src/components/NcRichText/autolink.ts around lines 148–159, especially how getRoute() removes the router base and resolves the remaining path. Check the reported cases for instance paths outside /apps/forms and paths under that base; done means only links within the app become app routes, while the other examples return null. The issue reports a reproduction through getRoute() but names no test file.
Written by the indexing model from the issue text.
Description
Describe the bug
In an app with a router, NcRichText turns links to pages of the same Nextcloud instance outside the app into app routes, whenever the path happens to match one of the app's routes. A link to the instance root or to a path with one segment, such as https://cloud.example.com/login, is rendered as a RouterLink to /apps/<app>/login in the same tab.
To reproduce
- An app whose router has base
/apps/formsand a route/:hash(Nextcloud Forms has this). - Render
<NcRichText text="[Log in](https://cloud.example.com/login)" use-markdown />inside that app. getRoute()returns/login, so the link opens/apps/forms/logininstead of/login.
Results of getRoute() with such a router:
| URL | getRoute() |
Expected |
|---|---|---|
https://cloud.example.com/ |
/ |
null |
https://cloud.example.com/login |
/login |
null |
/settings |
/settings |
null |
https://cloud.example.com/apps/forms/abc |
/abc |
/abc |
Cause
getRoute() strips the router base from the URL with removePrefixes(), which leaves the URL unchanged when it does not start with the base, and then resolves the unchanged path against the router:
A possible fix is to return null when relativeUrl does not start with relativeRouterBase.
Versions
@nextcloud/vue 9.14.1; the same code is on main (9.15.0).
Context
Found while replacing markdown-it with NcRichText in Nextcloud Forms (nextcloud/forms#3587). Reproduced by calling getRoute() from the 9.14.1 build with a vue-router instance configured like the Forms router; not checked in a browser.
Assisted by ClaudeCode:claude-opus-5-5
- Dominant language
- Vue
- Stars
- 246
- Forks
- 104
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 79
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nextcloud-libraries/nextcloud-vue
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
nextcloud-libraries/nextcloud-vue#9279 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud-libraries/nextcloud-vue#9278 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
nextcloud-libraries/nextcloud-vue#9277 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
nextcloud-libraries/nextcloud-vue#9275 ·
Maintainers usually reply within 1 day
-
design
Difficulty 1/5 Under an hour Newbie friendliness 92/100
nextcloud-libraries/nextcloud-vue#9271 ·
Maintainers usually reply within 1 day
All issues in nextcloud-libraries/nextcloud-vue
Similar issues
-
bug good first issue help wanted
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
N: AdGuard Mini for Mac P4: Low T: Ads
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
AdguardTeam/AdguardFilters#248776 ·
Maintainers usually reply within 1 day
-
bug frontend needs-design priority:P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
geolens-io/geolens#4331 ·
Maintainers usually reply within 1 day
-
bug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Gloria-Qi0311/info-442-F-team#102 · 1 comment ·
Maintainers usually reply within 1 day
-
status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
mastra-ai/mastra#32336 · 1 comment ·
Maintainers usually reply within 1 day