sendErrorPage() now can be called after downloads

Massimo Melina committed Dec 29, 2023 at 19:54 UTC 7f72f13649697f8dde70c33a1bc0217567a202cf
1 file changed +2
src/errorPages.ts
+2
@@ -10,6 +10,8 @@ export function getErrorSections() {
10 }
11
12 export async function sendErrorPage(ctx: Koa.Context, code: number) {
13 + ctx.type = 'text'
14 + ctx.set('content-disposition', '') // reset ctx.attachment
15 ctx.status = code
16 const msg = HTTP_MESSAGES[ctx.status]
17 if (!msg) return