fix(route): update parameter type for PATCH function and correct image directory handling

This commit is contained in:
Nils-Johan Gynther
2026-04-18 09:50:47 +02:00
parent e55d45c2bf
commit b4280f020e
2 changed files with 6 additions and 5 deletions
+3 -2
View File
@@ -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 });