set the mime type in the download blob

This commit is contained in:
Danny Coates 2017-08-09 12:56:32 -07:00
parent 626e578acb
commit 193664a8e8
No known key found for this signature in database
GPG key ID: 4C442633C62E00CB
5 changed files with 40 additions and 24 deletions

View file

@ -39,13 +39,15 @@ class FileReceiver extends EventEmitter {
}
const blob = new Blob([this.response]);
const type = xhr.getResponseHeader('Content-Type');
const meta = JSON.parse(xhr.getResponseHeader('X-File-Metadata'));
const fileReader = new FileReader();
fileReader.onload = function() {
const meta = JSON.parse(xhr.getResponseHeader('X-File-Metadata'));
resolve([
{
data: this.result,
filename: meta.filename,
type,
iv: meta.id
},
key
@ -76,7 +78,10 @@ class FileReceiver extends EventEmitter {
.then(decrypted => {
return Promise.resolve(decrypted);
}),
decodeURIComponent(fdata.filename)
{
name: decodeURIComponent(fdata.filename),
type: fdata.type
}
]);
});
}