1
0
mirror of https://github.com/RobinLinus/snapdrop.git synced 2025-05-16 23:50:11 -07:00
This commit is contained in:
RobinLinus 2018-10-11 01:36:28 +02:00
parent aa999e13c5
commit ba69167a76
2 changed files with 3 additions and 4 deletions

View File

@ -481,12 +481,10 @@ class FileDigester {
if (this._bytesReceived < this._size) return;
// we are done
let blob = new Blob(this._buffer, { type: this._mime });
let url = URL.createObjectURL(blob);
this._callback({
name: this._name,
mime: this._mime,
size: this._size,
url: url,
blob: blob
});
}

View File

@ -230,7 +230,8 @@ class ReceiveDialog extends Dialog {
_displayFile(file) {
const $a = this.$el.querySelector('#download');
$a.href = file.url;
const url = URL.createObjectURL(file.blob);
$a.href = url;
$a.download = file.name;
this.$el.querySelector('#fileName').textContent = file.name;
@ -240,7 +241,7 @@ class ReceiveDialog extends Dialog {
if (window.isDownloadSupported) return;
// fallback for iOS
$a.target = '_blank';
let reader = new FileReader();
const reader = new FileReader();
reader.onload = e => $a.href = reader.result;
reader.readAsDataURL(file.blob);
}