WebDAV problem uploading in Plone 4 with a password

Andrew Daviel <[email protected]>
Newsgroups gmane.comp.web.zope.plone.user
Message-ID <[email protected]>
A while back (2009) I wrote a script using Perl HTTP::DAV to upload
files to a Plone server, which I think at the time was Plone 3.
I do something like:

   $dav = new HTTP::DAV;
   $url = "http://plone.example.com/whatever/" ;
   $dav->credentials("foo","bar",$url) ;
   $dav->open($url) ;
   $dav->put($file) ;

Since we upgraded to Plone 4 (4.3.2), it won't work anymore.

I'm getting pretty confused here...

If I try to use the script to upload a document that does not exist on the 
server, I get an HTTP 500 error and an entry in event.log like
   ValueError: Disallowed subobject type: File  (for PDF, JPEG)  or
   ValueError: Disallowed subobject type: Document   (for an HTML file)
Same with uploading using cadaver.
  ("Add New" in the folder allows File, Image, Page etc. (but not Document))

If I try and upload a file that does already exist, it works.

If in cadaver, I try to upload a file that does exist, I get challenged 
for a username/password. Then I can upload the file.
And then, in that same cadaver session, I can upload a file that does not 
already exist.

When I look on the network, I can see that when I use the script to upload 
a file that does exist, $dav->put does a PUT and gets
   HTTP/1.1 401 Unauthorized
It then retries with
   Authorization: Basic blahblah
and succeeds.

But if the file does not exist, it gets
   500 Internal Server Error
to the initial PUT, and gives up.



The idea of trying a request without credentials, and then presenting the 
credentials in a subsequent attempt after a 401 response, is quite common 
and is referred to in RFC2616 section 10.4.2. So I believe this is a bug 
in Plone, not in HTTP::DAV


The full error in client1/event.log is like:
2014-09-11T18:51:50 ERROR Zope.SiteErrorLog 1410486710.570.730701749115 http://plone.example.com/blah/file/PUT
Traceback (innermost last):
   Module ZPublisher.Publish, line 138, in publish
   Module ZPublisher.mapply, line 77, in mapply
   Module ZPublisher.Publish, line 48, in call_object
   Module webdav.NullResource, line 157, in PUT
   Module Products.CMFCore.PortalFolder, line 274, in PUT_factory
   Module Products.ATContentTypes.lib.constraintypes, line 280, in invokeFactory
ValueError: Disallowed subobject type: File



-- 
Andrew Daviel, TRIUMF, Canada
Tel. +1 (604) 222-7376  (Pacific Time)

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.