Frontmatter
| id | 8558 |
| title | Fix: Anchor route regex to prevent unintended prefix matching |
| state | Closed |
| labels | bugaicore |
| assignees | tobiu |
| createdAt | Jan 11, 2026, 7:46 PM |
| updatedAt | Jan 11, 2026, 7:52 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8558 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 11, 2026, 7:52 PM |
Fix: Anchor route regex to prevent unintended prefix matching
tobiu assigned to @tobiu on Jan 11, 2026, 7:51 PM

tobiu
Jan 11, 2026, 7:51 PM
Input from Gemini 3 Pro:
✦ I have updated
src/controller/Base.mjsto anchor the generated route regexes with^and$. This ensures that routes like/newswill no longer match supersets like/news/tickets/123.I also removed the temporary debug logs and workarounds in
apps/portal/view/news/release/MainContainerController.mjs.
tobiu closed this issue on Jan 11, 2026, 7:52 PM
The current route matching logic in
Neo.controller.Baseuses unanchored regular expressions. This causes routes like/newsto match/news/tickets/8470, leading to incorrect controller activation.Solution: Modify
Neo.controller.Base.afterSetRoutesto anchor the generated regular expressions with^(start) and `# Fix: Anchor route regex to prevent unintended prefix matchingThe current route matching logic in
Neo.controller.Baseuses unanchored regular expressions. This causes routes like/newsto match/news/tickets/8470, leading to incorrect controller activation.Solution: Modify
Neo.controller.Base.afterSetRoutesto anchor the generated regular expressions with^(start) and (end)./news->/^\/news$//news/releases/{*itemId}->/^\/news\/releases\/(.*)$/This ensures precise route matching.