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