From fb190ef6050dd1d70b37778dad77992fa5f5ce11 Mon Sep 17 00:00:00 2001 From: uh wot Date: Sat, 1 Jul 2023 21:49:22 +0200 Subject: [PATCH] fixed content-disposition filename encoding --- main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index a7c814d..851a5e4 100644 --- a/main.js +++ b/main.js @@ -256,12 +256,14 @@ async function track(env, id, format, tagging, range_header) { let title = json.SNG_TITLE if (json.VERSION) title += ` ${json.VERSION}` + const filename = `${title} [${id}].${formats[format].ext}` + let init = { method: 'GET', headers: {} } let resp_init = { status: 200, headers: { 'content-type': formats[format].mime, - 'content-disposition': `inline; filename="${title.replaceAll('"', '\\"')} [${id}].${formats[format].ext}"`, + 'content-disposition': `inline; filename*=utf-8''${encodeURIComponent(filename)}`, 'accept-ranges': 'bytes' } }