From 43137c5d8fbba83a2ff8c1367e0bff87509bd3b0 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 9 Sep 2014 16:00:32 +0200 Subject: [PATCH] Quote filename in Content-Disposition (bug 540028) --- apps/versions/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/versions/views.py b/apps/versions/views.py index d044585e428..2a81f04ca06 100644 --- a/apps/versions/views.py +++ b/apps/versions/views.py @@ -129,7 +129,7 @@ def download_source(request, version_id): viewer=True, ignore_disabled=True) or acl.action_allowed(request, 'Editors', 'BinarySource'))): res = HttpResponseSendFile(request, version.source.path) - name = os.path.basename(version.source.path) - res['Content-Disposition'] = "attachment; filename={0}".format(name) + name = os.path.basename(version.source.path.replace('"', '')) + res['Content-Disposition'] = 'attachment; filename="{0}"'.format(name) return res raise http.Http404()