fix: convert buffers to Uint8Array
types issue
This commit is contained in:
parent
5388b977ac
commit
24b9091c05
2 changed files with 2 additions and 2 deletions
|
|
@ -20,7 +20,7 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
|
|||
|
||||
try {
|
||||
const buffer = await fs.readFile(filePath);
|
||||
return new NextResponse(buffer);
|
||||
return new NextResponse(new Uint8Array(buffer)); // convert to Uint8Array due to weird types issue
|
||||
} catch {
|
||||
return rateLimit.sendResponse({ error: "Image not found" }, 404);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export class RateLimit {
|
|||
let response: NextResponse;
|
||||
|
||||
if (Buffer.isBuffer(body)) {
|
||||
response = new NextResponse(body, { status, headers });
|
||||
response = new NextResponse(new Uint8Array(body), { status, headers }); // convert to Uint8Array due to weird types issue
|
||||
} else {
|
||||
response = NextResponse.json(body, { status, headers });
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue