Do not rely on angular trying to parse everything in the response for filemanager GET

This commit is contained in:
Johannes Zellner
2020-07-14 17:17:43 +02:00
parent 6956cfa32d
commit 3d17a33c43

View File

@@ -2407,7 +2407,12 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
if (download) {
window.open(client.apiOrigin + '/api/v1/apps/' + appId + '/files/' + path + '?download=true&access_token=' + token);
} else {
get('/api/v1/apps/' + appId + '/files/' + path, null, function (error, data, status) {
function responseHandler(data, headers, status) {
if (headers()['content-type'] && headers()['content-type'].indexOf('application/json') !== -1) return JSON.parse(data);
return data;
}
get('/api/v1/apps/' + appId + '/files/' + path, { transformResponse: responseHandler }, function (error, data, status) {
if (error) return callback(error);
if (status !== 200) return callback(new ClientError(status, data));