From 282cf0b595f118576af23f7f021dca3feee6966c Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Thu, 19 Jul 2018 12:11:55 -0700 Subject: [PATCH] use lib for setting content-disposition for more correctness --- app/serviceWorker.js | 3 ++- package.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/serviceWorker.js b/app/serviceWorker.js index 280e7ae8..06cddce1 100644 --- a/app/serviceWorker.js +++ b/app/serviceWorker.js @@ -1,6 +1,7 @@ import Keychain from './keychain'; import { downloadStream } from './api'; import { transform } from './streams'; +import contentDisposition from 'content-disposition'; let noSave = false; const map = new Map(); @@ -32,7 +33,7 @@ async function decryptStream(request) { const decrypted = keychain.decryptStream(readStream); const headers = { - 'Content-Disposition': 'attachment; filename=' + file.filename, + 'Content-Disposition': contentDisposition(file.filename), 'Content-Type': file.type, 'Content-Length': file.size }; diff --git a/package.json b/package.json index ebf16081..42b9ecb8 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "babel-preset-stage-2": "^6.24.1", "babel-preset-stage-3": "^6.24.1", "base64-js": "^1.3.0", + "content-disposition": "^0.5.2", "copy-webpack-plugin": "^4.5.2", "cross-env": "^5.2.0", "css-loader": "^1.0.0",