Remove hardcoded /app/data and fix submit for file downloads

This commit is contained in:
Johannes Zellner
2017-08-20 18:09:43 +02:00
parent 979c4e77e3
commit 82380b6b7c
2 changed files with 22 additions and 19 deletions

View File

@@ -27,8 +27,7 @@ angular.module('Application').controller('DebugController', ['$scope', '$locatio
filePath: '',
downloadUrl: function () {
var filePath = '/app/data/' + $scope.downloadFile.filePath;
filePath = filePath.replace(/\/*\//g, '/');
var filePath = $scope.downloadFile.filePath.replace(/\/*\//g, '/');
return Client.apiOrigin + '/api/v1/apps/' + $scope.selected.value + '/download?file=' + filePath + '&access_token=' + Client.getToken();
},
@@ -36,6 +35,11 @@ angular.module('Application').controller('DebugController', ['$scope', '$locatio
show: function () {
$scope.downloadFile.filePath = '';
$('#downloadFileModal').modal('show');
},
submit: function () {
// we have to click the link to make the browser do the download
$('#fileDownloadLink')[0].click();
}
};