#23 — Filename of BlobField is changed after webdav modification

StateResolved
Version: 1.0
AreaProcess
Issue typeBug
SeverityMedium
Submitted byzindep
Submitted onSep 03, 2009
Responsible Andreas Zeidler
Target release: 1.0
Return to tracker
Last modified on Nov 06, 2009 by Andreas Zeidler
Hi,

I have a problem with version 1.0b5 :

1) I create an AT custom content type with an upload in a BlobField (primary field) with a file which name is A.A. The id of the object is myid

2) I use ExternalEditor to update the file. After the webdav process of ExternalEditor, the name of the file has changed : it's now myid.

To fix that, I use the HTTP_FILENAME of the request:

class WebDavUpload(object):
    """ helper class when handling webdav uploads; the class is needed
        to be able to provide an adapter for this way of creating a blob """
    implements(IWebDavUpload)

def __init__(self, file, filename=None, mimetype=None, **kwargs):
     self.file = file
     # ZYM hack for webdav to avoid changing name
     # self.filename = filename
     req = kwargs.get('REQUEST', None)
     if req:
         self.filename = req.get('HTTP_FILENAME', '') or filename
     self.mimetype = mimetype
     self.kwargs = kwargs
Added byAndreas ZeidleronSep 30, 2009 11:46 AM
Issue state: UnconfirmedConfirmed
Responsible manager: (UNASSIGNED)witsch
Target release: None1.0
thanks for reporting this — i'll try to look into it asap (sorry about the lag).
Added byAndreas ZeidleronNov 06, 2009 09:49 AM
Issue state: ConfirmedIn progress
i could finally reproduce the issue — OSX's webdav support seems to be broken, but "cadaver" came to the rescue. however, i never encountered a 'HTTP_FILENAME' setting on the request, neither using an external editor (ZopeEditManager for OSX in this case) or webdav via the "Finder" or "cadaver".

nevertheless the 'filename' set on webdav uploads is always set to the basename of the path or id (see Products/Archetypes/WebDAVSupport.py(95)PUT()):

  filename = posixpath.basename(REQUEST.get('PATH_INFO', self.getId()))

the version in `WebDAVSupport.py` is hit, because the blob implementation doesn't implement `IBaseUnit`, btw. however, imho the stored filename should never be changed when updating a file via webdav. please note, that when creating the file via webdav the filename needs to be set regardless...

in any case, i'll try to get the tests to work and will commit a fix along those lines...
Added byAndreas ZeidleronNov 06, 2009 11:14 AM
Issue state: In progressResolved
the issue has been fixed in http://dev.plone.org/plone/changeset/31136 & will be released as part of beta7

No responses can be added.