From 75fff863516718cf8a292f79773487b115241426 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Fri, 16 Mar 2012 11:59:35 +0100 Subject: [PATCH] enclose filename in quotes to prevent truncation at spaces by browser --- browser/resource.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/browser/resource.py b/browser/resource.py index e2a9816..bb69813 100644 --- a/browser/resource.py +++ b/browser/resource.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2011 Helmut Merz helmutm@cy55.de +# Copyright (c) 2012 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -207,7 +207,9 @@ class ResourceView(BaseView): data = context.data if useAttachment: filename = adapted(self.context).localFilename or getName(self.context) - if not self.typeOptions('no_normalize_download_filename'): + if self.typeOptions('no_normalize_download_filename'): + filename = '"%s"' % filename + else: filename = NameChooser(getParent(self.context)).normalizeName(filename) response.setHeader('Content-Disposition', 'attachment; filename=%s' % filename)