From 530bf81940d0d0ad4d082b701736f9bb235ac4fa Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:48:08 +0300 Subject: [PATCH] #2127 Encode export PNG name --- src/endpoints/characters.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/endpoints/characters.js b/src/endpoints/characters.js index 571eec8c0..929818ade 100644 --- a/src/endpoints/characters.js +++ b/src/endpoints/characters.js @@ -1098,7 +1098,7 @@ router.post('/export', jsonParser, async function (request, response) { const fileContent = await fsPromises.readFile(filename); const contentType = mime.lookup(filename) || 'image/png'; response.setHeader('Content-Type', contentType); - response.setHeader('Content-Disposition', `attachment; filename=${path.basename(filename)}`); + response.setHeader('Content-Disposition', `attachment; filename="${encodeURI(path.basename(filename))}"`); return response.send(fileContent); } case 'json': {