fix: normalize dashboard export buffers
This commit is contained in:
parent
0f0f367b3a
commit
164d72e3ce
1 changed files with 4 additions and 6 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue