fix(core): Account for non-ASCII chars in filename on binary data download (#7742)

https://n8nio.sentry.io/issues/4641538638
This commit is contained in:
Iván Ovejero
2023-11-17 10:07:44 +01:00
committed by GitHub
parent abe36691ab
commit b4ebb1a28d
2 changed files with 23 additions and 2 deletions

View File

@@ -41,8 +41,9 @@ export class BinaryDataController {
if (mimeType) res.setHeader('Content-Type', mimeType);
if (action === 'download') {
res.setHeader('Content-Disposition', `attachment; filename="${fileName}"`);
if (action === 'download' && fileName) {
const encodedFilename = encodeURIComponent(fileName);
res.setHeader('Content-Disposition', `attachment; filename="${encodedFilename}"`);
}
return await this.binaryDataService.getAsStream(binaryDataId);