added content-length to sw response

This commit is contained in:
Danny Coates 2018-07-12 15:32:07 -07:00
parent ddeaf8076d
commit 5677390a45
No known key found for this signature in database
GPG Key ID: 4C442633C62E00CB
2 changed files with 4 additions and 1 deletions

View File

@ -108,6 +108,7 @@ export default class FileReceiver extends Nanobus {
requiresPassword: this.fileInfo.requiresPassword, requiresPassword: this.fileInfo.requiresPassword,
password: this.fileInfo.password, password: this.fileInfo.password,
url: this.fileInfo.url, url: this.fileInfo.url,
size: this.fileInfo.size,
noSave noSave
}; };
await this.sendMessageToSw(info); await this.sendMessageToSw(info);

View File

@ -33,7 +33,8 @@ async function decryptStream(request) {
const decrypted = file.keychain.decryptStream(readStream); const decrypted = file.keychain.decryptStream(readStream);
const headers = { const headers = {
'Content-Disposition': 'attachment; filename=' + file.filename 'Content-Disposition': 'attachment; filename=' + file.filename,
'Content-Length': file.size
}; };
return new Response(decrypted, { headers }); return new Response(decrypted, { headers });
@ -60,6 +61,7 @@ self.onmessage = event => {
const info = { const info = {
keychain: new Keychain(event.data.key), keychain: new Keychain(event.data.key),
filename: event.data.filename, filename: event.data.filename,
size: event.data.size,
progress: 0, progress: 0,
cancelled: false cancelled: false
}; };