(js) Fix download of exported folders under iOS

Whenever possible, we no longer rely on the FileSaver.js library to
download zip archives. Instead, we do a simple GET on the resource by
changing the window location.
pull/241/head
Francis Lachapelle 2018-05-16 16:46:00 -04:00
parent 0c5b5446dd
commit c966ad60e7
5 changed files with 23 additions and 6 deletions

2
NEWS
View File

@ -6,6 +6,7 @@ Enhancements
- [web] show current ordering setting in lists
- [web] remove invalid occurrences when modifying a recurrent event
- [web] updated Angular Material to version 1.1.9
- [web] allow mail flag addition/edition on mobile
Bug fixes
- [core] properly update the last-modified attribute (#4313)
@ -14,6 +15,7 @@ Bug fixes
- [web] prevent deletion of special folders using del key
- [web] fixed SAML2 session timeout handling during XHR requests
- [web] fixed renaming a folder under iOS
- [web] fixed download of exported folders under iOS
- [eas] improved alarms syncing with EAS devices (#4351)
- [eas] avoid potential cache update when breaking sync queries (#4422)

View File

@ -11,10 +11,11 @@
* @param {String} path - the base path of the external resource
* @param {Object} options - extra attributes to be associated to the object
*/
function Resource($http, $q, path, activeUser, options) {
function Resource($http, $q, $window, path, activeUser, options) {
angular.extend(this, {
_http: $http,
_q: $q,
_window: $window,
_path: path,
_activeUser: activeUser
});
@ -28,9 +29,9 @@
* @desc The factory we'll use to register with Angular.
* @return a new Resource object
*/
Resource.$factory = ['$http', '$q', function($http, $q) {
Resource.$factory = ['$http', '$q', '$window', function($http, $q, $window) {
return function(path, activeUser, options) {
return new Resource($http, $q, path, activeUser, options);
return new Resource($http, $q, $window, path, activeUser, options);
};
}];
@ -232,6 +233,15 @@
});
};
Resource.prototype.open = function(id, action) {
var path = [this._path];
if (id) path.push(id);
if (action) path.push(action);
path = _.compact(_.flatten(path)).join('/');
this._window.location.href = path;
};
/**
* @function remove
* @memberof Resource.prototype

View File

@ -723,7 +723,12 @@
data = { uids: _.map(selectedCards, 'id') };
}
return AddressBook.$$resource.download(this.id, 'export', data, options);
if (data) {
return AddressBook.$$resource.download(this.id, 'export', data, options);
}
else {
return AddressBook.$$resource.open(this.id, 'export', data, options);
}
};
/**

View File

@ -683,7 +683,7 @@
options = { filename: this.name + '.zip' };
return Mailbox.$$resource.download(this.id, 'exportFolder', null, options);
return Mailbox.$$resource.open(this.id, 'exportFolder', null, options);
};
/**

View File

@ -554,7 +554,7 @@
filename: this.name + '.ics'
};
return Calendar.$$resource.download(this.id + '.ics', 'export', null, options);
return Calendar.$$resource.open(this.id + '.ics', 'export', null, options);
};
/**