Permalink
Browse files

Make sure the id is safe before setting the filename as id

  • Loading branch information...
1 parent baf0ad5 commit 02693f154887d31875b94e0adc5f44723442d9e8 @pbauer pbauer committed Mar 15, 2013
Showing with 6 additions and 3 deletions.
  1. +4 −3 CHANGES.rst
  2. +2 −0 src/plone/app/blob/field.py
View
@@ -4,7 +4,8 @@ Changelog
1.5.8 (unreleased)
------------------
-- Nothing changed yet.
+- Make sure the id is safe before setting the filename as id
+ [pbauer]
1.5.7 (2013-03-05)
@@ -21,8 +22,8 @@ Changelog
- Fix BLOB migration when LinguaPlone is installed.
Also for ATFile.
- CAUTION: when the fix was discussed with witsch,
- he pointed to the fact that the files would be
+ CAUTION: when the fix was discussed with witsch,
+ he pointed to the fact that the files would be
entirely loaded in memory during migration.
This could potentially eat too much memory.
[gotcha]
@@ -1,4 +1,5 @@
from os import fstat
+from zope.container.interfaces import INameChooser
from zope.interface import implements
from StringIO import StringIO
from Acquisition import Implicit, aq_base
@@ -269,6 +270,7 @@ def fixAutoId(self, instance):
filename = IUserPreferredFileNameNormalizer(request).normalize(filename)
if filename and not filename == instance.getId():
# a file name was given, so the instance needs to be renamed...
+ filename = INameChooser(instance.__parent__).chooseName(filename, instance)
instance.setId(filename)
security.declareProtected(View, 'download')

0 comments on commit 02693f1

Please sign in to comment.