From f9ef9855df6935a718e2d08aae95aeddf309f139 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Wed, 8 Jun 2022 19:55:18 +0530 Subject: [PATCH] fix: invalid char in content-disposition header Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- packages/nocodb/src/lib/meta/NcMetaMgr.ts | 4 +++- .../nocodb/src/lib/meta/api/dataApis/dataAliasExportApis.ts | 4 +++- packages/nocodb/src/lib/meta/api/exportApis.ts | 4 +++- .../src/lib/meta/api/publicApis/publicDataExportApis.ts | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/nocodb/src/lib/meta/NcMetaMgr.ts b/packages/nocodb/src/lib/meta/NcMetaMgr.ts index bc08693641..0c950cc671 100644 --- a/packages/nocodb/src/lib/meta/NcMetaMgr.ts +++ b/packages/nocodb/src/lib/meta/NcMetaMgr.ts @@ -4551,7 +4551,9 @@ export default class NcMetaMgr { 'Access-Control-Expose-Headers': 'nc-export-offset', 'nc-export-offset': csvData.offset, 'nc-export-elapsed-time': csvData.elapsed, - 'Content-Disposition': `attachment; filename="${args.args.model_name}-export.csv"` + 'Content-Disposition': `attachment; filename="${encodeURI( + args.args.model_name + )}-export.csv"` }); res.send(csvData.data); } diff --git a/packages/nocodb/src/lib/meta/api/dataApis/dataAliasExportApis.ts b/packages/nocodb/src/lib/meta/api/dataApis/dataAliasExportApis.ts index c167aee66a..b0bb7b32fc 100644 --- a/packages/nocodb/src/lib/meta/api/dataApis/dataAliasExportApis.ts +++ b/packages/nocodb/src/lib/meta/api/dataApis/dataAliasExportApis.ts @@ -15,7 +15,9 @@ async function csvDataExport(req: Request, res: Response) { 'Access-Control-Expose-Headers': 'nc-export-offset', 'nc-export-offset': offset, 'nc-export-elapsed-time': elapsed, - 'Content-Disposition': `attachment; filename="${view.title}-export.csv"` + 'Content-Disposition': `attachment; filename="${encodeURI( + view.title + )}-export.csv"` }); res.send(data); } diff --git a/packages/nocodb/src/lib/meta/api/exportApis.ts b/packages/nocodb/src/lib/meta/api/exportApis.ts index e298d8b0c7..f661414aac 100644 --- a/packages/nocodb/src/lib/meta/api/exportApis.ts +++ b/packages/nocodb/src/lib/meta/api/exportApis.ts @@ -11,7 +11,9 @@ async function exportCsv(req: Request, res: Response) { 'Access-Control-Expose-Headers': 'nc-export-offset', 'nc-export-offset': offset, 'nc-export-elapsed-time': elapsed, - 'Content-Disposition': `attachment; filename="${view.title}-export.csv"` + 'Content-Disposition': `attachment; filename="${encodeURI( + view.title + )}-export.csv"` }); res.send(data); } diff --git a/packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts b/packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts index 32d76b1028..1954d92a54 100644 --- a/packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts +++ b/packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts @@ -122,7 +122,9 @@ async function exportCsv(req: Request, res: Response) { 'Access-Control-Expose-Headers': 'nc-export-offset', 'nc-export-offset': offset, 'nc-export-elapsed-time': elapsed, - 'Content-Disposition': `attachment; filename="${view.title}-export.csv"` + 'Content-Disposition': `attachment; filename="${encodeURI( + view.title + )}-export.csv"` }); res.send(data); }