Skip to content

Commit 1ab847f

Browse files
committed
bug fix: file download
1 parent dddefd7 commit 1ab847f

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

filemanager/static/filemanager/js/fileManager.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
14791479
// Download files
14801480

14811481
$scope.downloadFile = function () {
1482-
14831482
url = "/filemanager/downloadFile";
14841483
var downloadURL = $scope.currentPath + "/" + allFilesAndFolders[0];
14851484
window.location.href = url + '?domainName=' + domainName + '&fileToDownload=' + downloadURL;

filemanager/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ def downloadFile(request):
6666
admin = Administrator.objects.get(pk=userID)
6767
import urllib.parse
6868

69-
fileToDownload = urllib.parse.unquote(request.GET.get('fileToDownload'))
69+
fileToDownload = request.build_absolute_uri().split('fileToDownload')[1][1:]
70+
fileToDownload = urllib.parse.unquote(fileToDownload)
71+
7072
domainName = request.GET.get('domainName')
7173

7274
currentACL = ACLManager.loadedACL(userID)

plogical/test.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
import urllib.parse
2-
encodedStr = 'ville.laprairie.qc.ca&fileToDownload=/home/ville.laprairie.qc.ca/public_html/app/uploads/2019/05/2019-05-16_Terre-contamine%CC%81e-sur-Goyer-150x150.jpg'
3-
print(urllib.parse.unquote(encodedStr))

0 commit comments

Comments
 (0)