Open different mimetypes differently in filemanager

This commit is contained in:
Johannes Zellner
2020-07-21 16:27:51 +02:00
parent 1e5d28e2a2
commit 38682e48d4
3 changed files with 67 additions and 11 deletions

View File

@@ -2414,9 +2414,16 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout
};
// FileManager API
Client.prototype.filesGet = function (appId, path, download, callback) {
if (download) {
// mode can be 'download', 'open', 'link' or 'data'
Client.prototype.filesGet = function (appId, path, mode, callback) {
if (mode === 'download') {
window.open(client.apiOrigin + '/api/v1/apps/' + appId + '/files/' + path + '?download=true&access_token=' + token);
callback(null);
} else if (mode === 'open') {
window.open(client.apiOrigin + '/api/v1/apps/' + appId + '/files/' + path + '?download=false&access_token=' + token);
callback(null);
} else if (mode === 'link') {
callback(null, client.apiOrigin + '/api/v1/apps/' + appId + '/files/' + path + '?download=false&access_token=' + token);
} else {
function responseHandler(data, headers, status) {
if (headers()['content-type'] && headers()['content-type'].indexOf('application/json') !== -1) return JSON.parse(data);