Merge pull request #463 from marius-wieschollek/PASSMAN-264

[#264] Fix export file download in Firefox
This commit is contained in:
newhinton 2018-11-20 21:43:37 +01:00 committed by GitHub
commit c10fc9e835
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View file

@ -67,7 +67,7 @@ PassmanExporter.csv.export = function (credentials, FileService, EncryptService)
file_data += row_data.join(',') + "\n";
}
this.call_then();
download(file_data, 'passman-export.csv');
download(file_data, 'passman-export.csv', 'text/csv');
}).bind(this)).progress(function() {
});

22
js/vendor/download.js vendored
View file

@ -96,17 +96,17 @@
function saver(url, winMode){
if ('download' in anchor) { //html5 A[download]
anchor.href = url;
anchor.setAttribute("download", fileName);
anchor.className = "download-js-link";
anchor.innerHTML = "downloading...";
anchor.style.display = "none";
jQuery('.detailsView').append(anchor);
setTimeout(function() {
anchor.click();
jQuery('.download-js-link').remove();
if(winMode===true){setTimeout(function(){ self.URL.revokeObjectURL(anchor.href);}, 250 );}
}, 66);
var element = document.createElement('a');
element.setAttribute('href', url);
element.setAttribute('download', fileName);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
if(winMode===true){setTimeout(function(){ self.URL.revokeObjectURL(element.href);}, 250 );}
return true;
}