Skip to content

Commit 4aaf2f9

Browse files
authored
Fix invalid Content-Disposition (#357)
* Fix invalid Content-Disposition * Set empty Content-Disposition when non-ascii characters * Use contet-disposition library to accept non-ascii characters
1 parent 62d1f00 commit 4aaf2f9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/service/http-server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { Sanitizer } from '../sanitizer/Sanitizer';
1414
import * as bodyParser from 'body-parser';
1515
import * as multer from 'multer';
1616
import { isSanitizeRequest } from '../sanitizer/types';
17+
import * as contentDisposition from 'content-disposition';
1718

1819
const upload = multer({ storage: multer.memoryStorage() });
1920

@@ -234,7 +235,7 @@ export class HttpServer {
234235
const result = await this.browser.renderCSV(options);
235236

236237
if (result.fileName) {
237-
res.setHeader('Content-Disposition', `attachment; filename="${result.fileName}"`);
238+
res.setHeader('Content-Disposition', contentDisposition(result.fileName));
238239
}
239240
res.sendFile(result.filePath, (err) => {
240241
if (err) {

0 commit comments

Comments
 (0)