mirror of
https://github.com/timvisee/send.git
synced 2026-04-26 22:56:21 -04:00
changed to handle 404 during download, also removing progress listener once percent completion is 100 to avoid manipulating DOM twice
This commit is contained in:
@@ -20,6 +20,11 @@ class FileReceiver extends EventEmitter {
|
||||
};
|
||||
|
||||
xhr.onload = function(e) {
|
||||
|
||||
if (xhr.status === 404) {
|
||||
reject(new Error('The file has expired, or has already been deleted.'));
|
||||
}
|
||||
|
||||
let blob = new Blob([this.response]);
|
||||
let fileReader = new FileReader();
|
||||
fileReader.onload = function() {
|
||||
@@ -52,7 +57,8 @@ class FileReceiver extends EventEmitter {
|
||||
true,
|
||||
['encrypt', 'decrypt']
|
||||
)
|
||||
]).then(([fdata, key]) => {
|
||||
])
|
||||
.then(([fdata, key]) => {
|
||||
let salt = this.salt;
|
||||
return Promise.all([
|
||||
window.crypto.subtle.decrypt(
|
||||
|
||||
Reference in New Issue
Block a user