Download attachments of a message as a zip archive

This commit is contained in:
Francis Lachapelle
2016-12-07 14:38:33 -05:00
parent 2a2ebd553e
commit 011fae8a65
17 changed files with 487 additions and 289 deletions
@@ -192,14 +192,21 @@
},
responseType: 'arraybuffer',
cache: false,
transformResponse: function (data, headers) {
transformResponse: function (data, headers, status) {
var fileName, result, blob = null;
if (status < 200 || status > 299) {
throw new Error('Bad gateway');
}
if (data) {
blob = new Blob([data], { type: type });
}
fileName = getFileNameFromHeader(headers('content-disposition'));
if (options && options.filename) {
fileName = options.filename;
}
else {
getFileNameFromHeader(headers('content-disposition'));
}
if (!saveAs) {
throw new Error('To use Resource.download, FileSaver.js must be loaded.');
}