Skip to content

Commit 139f4ef

Browse files
committed
bug file download
1 parent 7949ffb commit 139f4ef

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

filemanager/static/filemanager/js/fileManager.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ function getCookie(name) {
1414
return cookieValue;
1515
}
1616

17-
1817
var fileManager = angular.module('fileManager', ['angularFileUpload']);
1918

2019
fileManager.config(['$interpolateProvider', function ($interpolateProvider) {
@@ -1481,10 +1480,9 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
14811480

14821481
$scope.downloadFile = function () {
14831482

1484-
url = "/filemanager/downloadFile/";
1483+
url = "/filemanager/downloadFile";
14851484
var downloadURL = $scope.currentPath + "/" + allFilesAndFolders[0];
1486-
1487-
window.location.href = url + '?domainName=' + domainName + '?downloadURL=' + downloadURL;
1485+
window.location.href = url + '?domainName=' + domainName + '&fileToDownload=' + downloadURL;
14881486
};
14891487

14901488

filemanager/views.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ def downloadFile(request):
8484
userID = request.session['userID']
8585
admin = Administrator.objects.get(pk=userID)
8686

87-
fileToDownload = '/home/cyberpanel.xyz/public_html/hello.txt'
88-
domainName = 'cyberpanel.xyz'
87+
fileToDownload = request.GET.get('fileToDownload')
88+
domainName = request.GET.get('domainName')
8989

9090
currentACL = ACLManager.loadedACL(userID)
9191

@@ -94,8 +94,6 @@ def downloadFile(request):
9494
else:
9595
return ACLManager.loadErrorJson('permissionsChanged', 0)
9696

97-
logging.CyberCPLogFileWriter.writeToFile('test')
98-
9997
response = HttpResponse(content_type='application/force-download')
10098
response['Content-Disposition'] = 'attachment; filename=%s' % (fileToDownload.split('/')[-1])
10199
response['X-LiteSpeed-Location'] = '%s' % (fileToDownload)

plogical/adminPass.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from plogical.acl import ACLManager
1212
from packages.models import Package
1313
from baseTemplate.models import version
14-
from CLManager.models import CLPackages
1514

1615
if not os.geteuid() == 0:
1716
sys.exit("\nOnly root can run this script\n")

0 commit comments

Comments
 (0)