fix(route): update parameter type for PATCH function and correct image directory handling
This commit is contained in:
@@ -2,7 +2,8 @@ import { NextRequest, NextResponse } from 'next/server';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
const IMAGE_DIR = process.env.IMAGE_DIR || '/app/public/images';
|
||||
// turbopackIgnore: true — IMAGE_DIR är en runtime env-variabel, inte statisk sökväg
|
||||
const IMAGE_DIR: string = /* turbopackIgnore: true */ (process.env.IMAGE_DIR || '/app/public/images') as string;
|
||||
|
||||
export async function GET(
|
||||
_request: NextRequest,
|
||||
@@ -15,7 +16,7 @@ export async function GET(
|
||||
return new NextResponse('Not found', { status: 404 });
|
||||
}
|
||||
|
||||
const filePath = path.join(/*turbopackIgnore: true*/ IMAGE_DIR, filename);
|
||||
const filePath = path.join(IMAGE_DIR, filename);
|
||||
|
||||
if (!fs.existsSync(filePath)) {
|
||||
return new NextResponse('Not found', { status: 404 });
|
||||
|
||||
Reference in New Issue
Block a user