diff --git a/web/app/api/print-layout/route.ts b/web/app/api/print-layout/route.ts index 0f16fe4..90ea0d4 100644 --- a/web/app/api/print-layout/route.ts +++ b/web/app/api/print-layout/route.ts @@ -45,7 +45,7 @@ export async function POST(request: NextRequest) { return NextResponse.json({ success: true, - printLayoutUrl: `/api/zine/${zineId}/print`, + printLayoutUrl: `/api/zine/${zineId}?print=true`, filename: `${zineName || "mycrozine"}_print.png`, }); } catch (error) { diff --git a/web/app/api/zine/[id]/route.ts b/web/app/api/zine/[id]/route.ts index cf2d221..029f855 100644 --- a/web/app/api/zine/[id]/route.ts +++ b/web/app/api/zine/[id]/route.ts @@ -62,13 +62,19 @@ export async function GET(request: NextRequest, context: RouteContext) { } const printBuffer = await readFileAsBuffer(printPath); - return new NextResponse(new Uint8Array(printBuffer), { - headers: { - "Content-Type": "image/png", - "Content-Disposition": `attachment; filename="${id}_print.png"`, - "Cache-Control": "public, max-age=31536000, immutable", - }, - }); + const downloadParam = url.searchParams.get("download"); + + const headers: Record = { + "Content-Type": "image/png", + "Cache-Control": "public, max-age=31536000, immutable", + }; + + // Only add Content-Disposition for explicit downloads + if (downloadParam === "true") { + headers["Content-Disposition"] = `attachment; filename="${id}_print.png"`; + } + + return new NextResponse(new Uint8Array(printBuffer), { headers }); } // Return zine metadata diff --git a/web/app/create/page.tsx b/web/app/create/page.tsx index b54b72d..fbfb06c 100644 --- a/web/app/create/page.tsx +++ b/web/app/create/page.tsx @@ -621,7 +621,7 @@ export default function CreatePage() { {/* Actions */}
{zine.printLayoutUrl && (