Fix saving attachments

// FREEBIE
This commit is contained in:
lilia 2017-04-19 15:57:54 -07:00 committed by Scott Nonnenberg
parent 2ae48ad9cd
commit b6e5439860
No known key found for this signature in database
GPG key ID: A4931C09644C654B

View file

@ -172,22 +172,10 @@
return suggestion;
},
saveFile: function() {
var blob = this.blob;
var w = extension.windows.getViews()[0];
if (w && w.chrome && w.chrome.fileSystem) {
w.chrome.fileSystem.chooseEntry({
type: 'saveFile', suggestedName: this.suggestedName()
}, function(entry) {
if (!entry) {
return;
}
entry.createWriter(function(fileWriter) {
fileWriter.write(blob);
});
});
} else {
console.log('Failed to get window');
}
var url = window.URL.createObjectURL(this.blob, { type: 'octet/stream' });
var a = $('<a>').attr({ href: url, download: this.suggestedName() });
a[0].click();
window.URL.revokeObjectURL(url);
},
render: function() {
if (!this.isImage()) {