Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-route-conflict-nested-groups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: detect route conflicts in nested groups with optional params
2 changes: 1 addition & 1 deletion packages/kit/src/core/sync/create_manifest_data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ function prevent_conflicts(routes) {
// remove leading/trailing/duplicated slashes caused by prior
// manipulation of optional parameters and (groups)
const key = permutation
.replace(/\/{2,}/, '/')
.replace(/\/{2,}/g, '/')
.replace(/^\//, '')
.replace(/\/$/, '');

Expand Down
7 changes: 7 additions & 0 deletions packages/kit/src/core/sync/create_manifest_data/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,13 @@ test('prevents route conflicts between groups', () => {
);
});

test('prevents route conflicts between nested groups with optional params', () => {
assert.throws(
() => create('samples/conflicting-nested-groups'),
/routes conflict with each other/
);
});

test('errors with multiple layouts on same directory', () => {
assert.throws(
() => create('samples/multiple-layouts'),
Expand Down
Loading