Fix saving attachments
// FREEBIE
This commit is contained in:
parent
2ae48ad9cd
commit
b6e5439860
1 changed files with 4 additions and 16 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Reference in a new issue