From 618e0c55c1008f17e12ace86de85d1d02e2ba3c9 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Mon, 16 Jan 2017 10:17:28 +0100 Subject: [PATCH 1/1] further prettify --- stage2/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stage2/views.py b/stage2/views.py index 59c2d82..ca9f935 100644 --- a/stage2/views.py +++ b/stage2/views.py @@ -55,7 +55,8 @@ def attachment_download(attachment): response = HttpResponse(content_type='application/force-download') response.write(attachment.file.read()) base, ext = attachment.filename().rsplit('.', 1) - response['Content-Disposition'] = 'attachment; filename="%s.%s"' % (base[:20].replace('\n', '').strip(), ext) + response['Content-Disposition'] = 'attachment; filename="%s.%s"' % ( + base.strip()[:20].replace('\n', '').strip(), ext) response['Content-Length'] = response.tell() return response -- 2.20.1