X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/aef7509e13bc28f6bad725fbd6392b61c4d9a405..78847af2ffb6c7d513e08c2e8f66663903038b84:/stage2/views.py?ds=sidebyside diff --git a/stage2/views.py b/stage2/views.py index 7f3422e..59c2d82 100644 --- a/stage2/views.py +++ b/stage2/views.py @@ -54,7 +54,8 @@ def upload(request, assignment_id, participant_id, key): def attachment_download(attachment): response = HttpResponse(content_type='application/force-download') response.write(attachment.file.read()) - response['Content-Disposition'] = 'attachment; filename="%s"' % attachment.filename() + base, ext = attachment.filename().rsplit('.', 1) + response['Content-Disposition'] = 'attachment; filename="%s.%s"' % (base[:20].replace('\n', '').strip(), ext) response['Content-Length'] = response.tell() return response