(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.
This commit is contained in:
parent
0c5b5446dd
commit
c966ad60e7
2
NEWS
2
NEWS
|
@ -6,6 +6,7 @@ Enhancements
|
||||||
- [web] show current ordering setting in lists
|
- [web] show current ordering setting in lists
|
||||||
- [web] remove invalid occurrences when modifying a recurrent event
|
- [web] remove invalid occurrences when modifying a recurrent event
|
||||||
- [web] updated Angular Material to version 1.1.9
|
- [web] updated Angular Material to version 1.1.9
|
||||||
|
- [web] allow mail flag addition/edition on mobile
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
- [core] properly update the last-modified attribute (#4313)
|
- [core] properly update the last-modified attribute (#4313)
|
||||||
|
@ -14,6 +15,7 @@ Bug fixes
|
||||||
- [web] prevent deletion of special folders using del key
|
- [web] prevent deletion of special folders using del key
|
||||||
- [web] fixed SAML2 session timeout handling during XHR requests
|
- [web] fixed SAML2 session timeout handling during XHR requests
|
||||||
- [web] fixed renaming a folder under iOS
|
- [web] fixed renaming a folder under iOS
|
||||||
|
- [web] fixed download of exported folders under iOS
|
||||||
- [eas] improved alarms syncing with EAS devices (#4351)
|
- [eas] improved alarms syncing with EAS devices (#4351)
|
||||||
- [eas] avoid potential cache update when breaking sync queries (#4422)
|
- [eas] avoid potential cache update when breaking sync queries (#4422)
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,11 @@
|
||||||
* @param {String} path - the base path of the external resource
|
* @param {String} path - the base path of the external resource
|
||||||
* @param {Object} options - extra attributes to be associated to the object
|
* @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, {
|
angular.extend(this, {
|
||||||
_http: $http,
|
_http: $http,
|
||||||
_q: $q,
|
_q: $q,
|
||||||
|
_window: $window,
|
||||||
_path: path,
|
_path: path,
|
||||||
_activeUser: activeUser
|
_activeUser: activeUser
|
||||||
});
|
});
|
||||||
|
@ -28,9 +29,9 @@
|
||||||
* @desc The factory we'll use to register with Angular.
|
* @desc The factory we'll use to register with Angular.
|
||||||
* @return a new Resource object
|
* @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 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
|
* @function remove
|
||||||
* @memberof Resource.prototype
|
* @memberof Resource.prototype
|
||||||
|
|
|
@ -723,7 +723,12 @@
|
||||||
data = { uids: _.map(selectedCards, 'id') };
|
data = { uids: _.map(selectedCards, 'id') };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data) {
|
||||||
return AddressBook.$$resource.download(this.id, 'export', data, options);
|
return AddressBook.$$resource.download(this.id, 'export', data, options);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return AddressBook.$$resource.open(this.id, 'export', data, options);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -683,7 +683,7 @@
|
||||||
|
|
||||||
options = { filename: this.name + '.zip' };
|
options = { filename: this.name + '.zip' };
|
||||||
|
|
||||||
return Mailbox.$$resource.download(this.id, 'exportFolder', null, options);
|
return Mailbox.$$resource.open(this.id, 'exportFolder', null, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -554,7 +554,7 @@
|
||||||
filename: this.name + '.ics'
|
filename: this.name + '.ics'
|
||||||
};
|
};
|
||||||
|
|
||||||
return Calendar.$$resource.download(this.id + '.ics', 'export', null, options);
|
return Calendar.$$resource.open(this.id + '.ics', 'export', null, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue