fix: read file content into memory before closing file handle in download view (#247)
This commit is contained in:
committed by
GitHub
parent
26853a0209
commit
70e091e213
@@ -395,14 +395,13 @@ def check_for_file(request):
|
||||
def download(request):
|
||||
filename = request.GET['filename']
|
||||
uuid = request.GET['uuid']
|
||||
#filename = filename+".exe"
|
||||
file_path = os.path.join('exe',uuid,filename)
|
||||
file_path = os.path.join('exe', uuid, filename)
|
||||
with open(file_path, 'rb') as file:
|
||||
response = HttpResponse(file, headers={
|
||||
'Content-Type': 'application/vnd.microsoft.portable-executable',
|
||||
'Content-Disposition': f'attachment; filename="{filename}"'
|
||||
})
|
||||
|
||||
content = file.read()
|
||||
response = HttpResponse(content, headers={
|
||||
'Content-Type': 'application/vnd.microsoft.portable-executable',
|
||||
'Content-Disposition': f'attachment; filename="{filename}"'
|
||||
})
|
||||
return response
|
||||
|
||||
def get_png(request):
|
||||
|
||||
Reference in New Issue
Block a user