LearnNewsExamplesServices
Frontmatter
id8558
titleFix: Anchor route regex to prevent unintended prefix matching
stateClosed
labels
bugaicore
assigneestobiu
createdAtJan 11, 2026, 7:46 PM
updatedAtJan 11, 2026, 7:52 PM
githubUrlhttps://github.com/neomjs/neo/issues/8558
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 11, 2026, 7:52 PM

Fix: Anchor route regex to prevent unintended prefix matching

Closed v11.20.0 bugaicore
tobiu
tobiu commented on Jan 11, 2026, 7:46 PM

The current route matching logic in Neo.controller.Base uses unanchored regular expressions. This causes routes like /news to match /news/tickets/8470, leading to incorrect controller activation.

Solution: Modify Neo.controller.Base.afterSetRoutes to anchor the generated regular expressions with ^ (start) and `# Fix: Anchor route regex to prevent unintended prefix matching

The current route matching logic in Neo.controller.Base uses unanchored regular expressions. This causes routes like /news to match /news/tickets/8470, leading to incorrect controller activation.

Solution: Modify Neo.controller.Base.afterSetRoutes to anchor the generated regular expressions with ^ (start) and (end).

  • /news -> /^\/news$/
  • /news/releases/{*itemId} -> /^\/news\/releases\/(.*)$/

This ensures precise route matching.

tobiu added the bug label on Jan 11, 2026, 7:46 PM
tobiu added the ai label on Jan 11, 2026, 7:46 PM
tobiu added the core label on Jan 11, 2026, 7:46 PM
tobiu referenced in commit f2dfe29 - "fix: Anchor route regex to prevent unintended prefix matching (#8558)" on Jan 11, 2026, 7:51 PM
tobiu assigned to @tobiu on Jan 11, 2026, 7:51 PM
tobiu
tobiu Jan 11, 2026, 7:51 PM

Input from Gemini 3 Pro:

✦ I have updated src/controller/Base.mjs to anchor the generated route regexes with ^ and $. This ensures that routes like /news will 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