Skip to content

Commit

Permalink
chore(remix-dev): don't allow * to be anywhere in segment (#5014)
Browse files Browse the repository at this point in the history
* chore(remix-dev): don't allow * to be anywhere in segment

Signed-off-by: Logan McAnsh <[email protected]>

* Create little-lobsters-decide.md

Signed-off-by: Logan McAnsh <[email protected]>
  • Loading branch information
mcansh authored Jan 5, 2023
1 parent 5663081 commit 45d4491
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .changeset/little-lobsters-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"remix": patch
"@remix-run/dev": patch
---

don't allow `*` to be anywhere in flat route segment
9 changes: 1 addition & 8 deletions packages/remix-dev/__tests__/flat-routes-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ describe("flatRoutes", () => {
let invalidSplatFiles: string[] = [
"routes/about.[*].tsx",
"routes/about.*.tsx",
"routes/about.[.[.*].].tsx",
];

for (let invalid of invalidSplatFiles) {
Expand Down Expand Up @@ -369,14 +370,6 @@ describe("flatRoutes", () => {
path: ".",
},
],
[
"routes/about.[.[.*].].tsx",
{
id: "routes/about.[.[.*].]",
parentId: "routes/about",
path: ".[.*/]",
},
],

// Optional route segments
[
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-dev/config/flat-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function getRouteSegments(routeId: string) {
);
};

if (rawRouteSegment === "*") {
if (rawRouteSegment.includes("*")) {
return notSupportedInRR(rawRouteSegment, "*");
}

Expand Down

0 comments on commit 45d4491

Please sign in to comment.