enclose filename in quotes to prevent truncation at spaces by browser

This commit is contained in:
Helmut Merz 2012-03-16 11:59:35 +01:00
parent 6bb4f35091
commit 75fff86351

View file

@ -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)