mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix(pdf): restore downloads on PDF conversion preset pages (#629)
Adds downloadUrl/originalSize/processedSize to the pdf-to-image route's synchronous response so PDF conversion presets (pdf-to-png, pdf-to-jpg, pdf-to-tiff) satisfy the standard tool-result contract and show their download action again. Fixes #623 Co-authored-by: EuanTop <euan@mail.bnu.edu.cn>
This commit is contained in:
@@ -2424,6 +2424,15 @@ paths:
|
||||
properties:
|
||||
jobId:
|
||||
type: string
|
||||
downloadUrl:
|
||||
type: string
|
||||
description: URL to download all pages as ZIP
|
||||
originalSize:
|
||||
type: integer
|
||||
description: Input PDF size in bytes
|
||||
processedSize:
|
||||
type: integer
|
||||
description: Output ZIP size in bytes
|
||||
pageCount:
|
||||
type: integer
|
||||
description: Total pages in the PDF
|
||||
|
||||
@@ -396,14 +396,18 @@ export function registerPdfToImageRoute(
|
||||
await zipDone;
|
||||
const zipBuffer = Buffer.concat(zipChunks);
|
||||
await putObject(`outputs/${jobId}/${zipFilename}`, zipBuffer);
|
||||
const zipUrl = `/api/v1/download/${jobId}/${encodeURIComponent(zipFilename)}`;
|
||||
|
||||
return reply.send({
|
||||
jobId,
|
||||
downloadUrl: zipUrl,
|
||||
originalSize: fileBuffer.length,
|
||||
processedSize: zipBuffer.length,
|
||||
pageCount: totalPages,
|
||||
selectedPages,
|
||||
format: settings.format,
|
||||
pages,
|
||||
zipUrl: `/api/v1/download/${jobId}/${encodeURIComponent(zipFilename)}`,
|
||||
zipUrl,
|
||||
zipSize: zipBuffer.length,
|
||||
});
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user