WIP 1.51.11: money on v2 via v1 handlers (viaV1 adapter)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls1vMdg2GYqbnKZmPaX1ot
This commit is contained in:
2026-10-29 13:43:36 +02:00
co-authored by Claude Opus 5.5
parent de08f057ad
commit fb36e9c8ac
36 changed files with 10334 additions and 154 deletions
+2 -2
View File
@@ -105,7 +105,7 @@ export function mount(router: Router, list: AnyRoute[] = routes): void {
throw new ApiError('INTERNAL', 'Something went wrong on the server.');
}
if (def.file) {
const f = (checked.data as { data: { contentType: string; filename: string; body: string } }).data;
const f = (checked.data as { data: { contentType: string; filename: string; body: string | Buffer } }).data;
res.setHeader('Content-Type', f.contentType);
res.setHeader('Content-Disposition', `attachment; filename="${f.filename.replace(/"/g, '')}"`);
res.status(def.status ?? 200).send(f.body);
@@ -121,4 +121,4 @@ export function mount(router: Router, list: AnyRoute[] = routes): void {
}
/** The `response` of a `file` route: what the handler hands back to be sent as a download. */
export const fileResponse = z.object({ data: z.object({ contentType: z.string(), filename: z.string(), body: z.string() }) });
export const fileResponse = z.object({ data: z.object({ contentType: z.string(), filename: z.string(), body: z.union([z.string(), z.instanceof(Buffer)]) }) });