Private
Public Access
1
0

more coverage

This commit is contained in:
Sander Roosendaal
2021-04-26 18:26:16 +02:00
parent 9e2a97e721
commit 594ee6239a
11 changed files with 133 additions and 91 deletions

View File

@@ -28,7 +28,11 @@ def download_fit(request,filename=''):
raise PermissionDenied("You are not allowed to download this file")
fitfile = ps.fitfile
response = HttpResponse(fitfile)
try:
response = HttpResponse(fitfile)
except FileNotFoundError:
raise Http404("File not found")
response['Content-Disposition'] = 'attachment; filename="%s"' % filename
response['Content-Type'] = 'application/octet-stream'