#2127 Encode export PNG name

This commit is contained in:
Cohee 2024-04-24 10:48:08 +03:00
parent 2bba186c9e
commit 530bf81940

View File

@ -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': {