added content-length to sw response
This commit is contained in:
parent
ddeaf8076d
commit
5677390a45
|
@ -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);
|
||||||
|
|
|
@ -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
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue