next.js
6ec80654 - fix: strip _NEXTSEP_ from interpolated pathnames (#84430)

Commit
73 days ago
fix: strip _NEXTSEP_ from interpolated pathnames (#84430) ## What Fixes an issue where internal route normalization markers (`_NEXTSEP_`) were leaking into compiled URLs for interception routes with adjacent dynamic parameters. ## Why When Next.js normalizes route patterns like `/photos/(.):author/:id` for path-to-regexp validation, it inserts `_NEXTSEP_` as a literal separator between adjacent parameters. This internal marker was appearing in the final compiled URLs (e.g., `/photos/(.)_NEXTSEP_next/123` instead of `/photos/(.)next/123`), exposing implementation details to users. ## How - Modified `safeCompile` to wrap the path-to-regexp compiler when normalization is applied - The wrapper calls `stripNormalizedSeparators` to remove the internal marker from compiled output - Added targeted regex pattern that only strips separators after interception route markers (`)_NEXTSEP_` → `)`) - Preserved separators in user content that legitimately contains this string NAR-431
Author
Parents
Loading