diff --git a/src/app/api/dashboards/[id]/export/[format]/route.ts b/src/app/api/dashboards/[id]/export/[format]/route.ts index 6ddf660..264aaeb 100644 --- a/src/app/api/dashboards/[id]/export/[format]/route.ts +++ b/src/app/api/dashboards/[id]/export/[format]/route.ts @@ -146,10 +146,9 @@ export async function GET( right: "18px", }, }) - const bytes = pdfBuffer instanceof Uint8Array ? pdfBuffer : new Uint8Array(pdfBuffer) - const arrayBuffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) + const bytes = new Uint8Array(pdfBuffer) const filename = slugifyFilename(detail.dashboard.name ?? "dashboard", "pdf") - return new NextResponse(arrayBuffer, { + return new NextResponse(bytes, { status: 200, headers: { "Content-Type": "application/pdf", @@ -160,10 +159,9 @@ export async function GET( } const screenshot = await page.screenshot({ type: "png", fullPage: true }) - const bytes = screenshot instanceof Uint8Array ? screenshot : new Uint8Array(screenshot) - const arrayBuffer = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) + const bytes = new Uint8Array(screenshot) const filename = slugifyFilename(detail.dashboard.name ?? "dashboard", "png") - return new NextResponse(arrayBuffer, { + return new NextResponse(bytes, { status: 200, headers: { "Content-Type": "image/png",