Browse Source

Merge pull request #2292 from nocodb/fix/2286-download-csv-error

fix: invalid char in content-disposition header
pull/2307/head
navi 3 years ago committed by GitHub
parent
commit
a0c35729ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      packages/nocodb/src/lib/meta/NcMetaMgr.ts
  2. 4
      packages/nocodb/src/lib/meta/api/dataApis/dataAliasExportApis.ts
  3. 4
      packages/nocodb/src/lib/meta/api/exportApis.ts
  4. 4
      packages/nocodb/src/lib/meta/api/publicApis/publicDataExportApis.ts

4
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);
}

4
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);
}

4
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);
}

4
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);
}

Loading…
Cancel
Save