download file on web fixed

This commit is contained in:
Equilibrium ITO
2024-03-18 12:59:41 +01:00
parent c08531a630
commit 75623da07e
5 changed files with 32 additions and 17 deletions
@@ -1034,11 +1034,12 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}
downloadFileFromBrowser(fileName: string, data: any): void {
const linkSource = data;
const downloadLink = document.createElement("a");
downloadLink.href = linkSource;
downloadLink.download = fileName;
downloadLink.click();
const link = document.createElement("a")
link.href = `data:${data.type}';base64,${data.image_url}`;
link.download = fileName
link.click()
link.remove()
}
b64toBlob(b64Data, contentType) {
@@ -1120,7 +1121,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
});
modal.present();
} else {
this.downloadFileFromBrowser(msg.attachments[0].title, msg.attachments[0].attachmentsUrl)
this.downloadFileFromBrowser(msg.attachments[0].title, msg.attachments[0])
}
} else {
this.openFile(msg.attachments.image_url, msg.attachments[0].title, msg.file.type);