Skip to content

Commit 82eaac4

Browse files
committed
fix: route dynamic
1 parent a3ab617 commit 82eaac4

File tree

1 file changed

+3
-3
lines changed
  • templates/types/streaming/nextjs/app/api/files/[...slug]

1 file changed

+3
-3
lines changed

templates/types/streaming/nextjs/app/api/files/[...slug]/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { DATA_DIR } from "../../chat/engine/loader";
99
*/
1010
export async function GET(
1111
_request: NextRequest,
12-
{ params }: { params: { slug: string[] } },
12+
{ params }: { params: Promise<{ slug: string[] }> },
1313
) {
14-
const slug = params.slug;
14+
const slug = (await params).slug;
1515

1616
if (!slug) {
1717
return NextResponse.json({ detail: "Missing file slug" }, { status: 400 });
@@ -21,7 +21,7 @@ export async function GET(
2121
return NextResponse.json({ detail: "Invalid file path" }, { status: 400 });
2222
}
2323

24-
const [folder, ...pathTofile] = params.slug; // data, file.pdf
24+
const [folder, ...pathTofile] = slug; // data, file.pdf
2525
const allowedFolders = ["data", "output"];
2626

2727
if (!allowedFolders.includes(folder)) {

0 commit comments

Comments
 (0)