mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 02:33:46 +00:00
downloader for edge and safari
This commit is contained in:
@@ -133,9 +133,8 @@ export class ExportController {
|
||||
}
|
||||
|
||||
private downloadFile(csv: string): void {
|
||||
const csvBlob = new Blob([csv], { type: 'text/plain' });
|
||||
const fileName = this.makeFileName();
|
||||
BrowserApi.downloadFile(this.$window, csvBlob, fileName);
|
||||
BrowserApi.downloadFile(this.$window, csv, { type: 'text/plain' }, fileName);
|
||||
}
|
||||
|
||||
private makeFileName(): string {
|
||||
|
||||
@@ -162,21 +162,7 @@ angular
|
||||
return cryptoService.decryptFromBytes(req.response, key);
|
||||
}).then(function (decBuf) {
|
||||
var blob = new Blob([decBuf]);
|
||||
|
||||
if ($window.navigator.msSaveOrOpenBlob) {
|
||||
// Currently bugged in Edge. See
|
||||
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8178877/
|
||||
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8477778/
|
||||
$window.navigator.msSaveBlob(csvBlob, attachment.fileName);
|
||||
}
|
||||
else {
|
||||
var a = $window.document.createElement('a');
|
||||
a.href = $window.URL.createObjectURL(blob);
|
||||
a.download = attachment.fileName;
|
||||
$window.document.body.appendChild(a);
|
||||
a.click();
|
||||
$window.document.body.removeChild(a);
|
||||
}
|
||||
BrowserApi.downloadFile($window, decBuf, null, attachment.fileName);
|
||||
|
||||
$timeout(function () {
|
||||
attachment.downloading = false;
|
||||
|
||||
Reference in New Issue
Block a user