File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
app/api/get-schema/[name] Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,13 @@ import { NextResponse, NextRequest } from "next/server";
22import fs from "fs/promises" ;
33import path from "path" ;
44
5+ // Explicitly define the type for the context parameter
6+ interface RouteContext {
7+ params : {
8+ name : string ;
9+ } ;
10+ }
11+
512// Helper function to safely join paths and prevent traversal
613function safeJoin ( base : string , target : string ) : string | null {
714 const targetPath = "." + path . normalize ( "/" + target ) ;
@@ -16,9 +23,9 @@ function safeJoin(base: string, target: string): string | null {
1623
1724export async function GET (
1825 request : NextRequest ,
19- { params } : { params : { name : string } }
26+ context : RouteContext // Use the explicitly defined type
2027) {
21- const schemaName = params . name ;
28+ const schemaName = context . params . name ;
2229
2330 if ( ! schemaName ) {
2431 return NextResponse . json ( { error : "Schema name required" } , { status : 400 } ) ;
You can’t perform that action at this time.
0 commit comments