WebdavClient.py test using files yields 404: Not Found error

Bug #1132979 reported by Jørgen Johanson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Python WebDAV Library
New
Undecided
Unassigned

Bug Description

When running this (trying to use the test script to download zzzz.txt):

  python /usr/local/lib/python2.7/dist-packages/webdav/WebdavClient.py http://localwebdav/webdav/zzzz.txt

I get this request (note the trailing '/'):

  2013-02-25 21:21:07,559: DEBUG: REQUEST Send GET for /webdav/zzzz.txt/

and the request fails with (as would be expected since there is no folder called 'zzzz.txt'):

  2013-02-25 21:21:12,831: DEBUG: Method: GET Status 404: Not Found

It looks like the test script creates a 'CollectionStorer(webdavUrl, validateResourceNames=False)' even when trying to download a file. The 'CollectionStorer' constructor unconditionally appends a '/' to the URL (WebdavClient.py, line 575 and 576). I guess that when trying to download a file (and not a directory), a 'ResourceStorer' should be created instead of a 'CollectionStorer' (I have tried and this seems to work OK, the requested file is downloaded as it should)?

Around line 869:

    if webdavUrl[-1] != "/":
        webdavConnection = ResourceStorer(webdavUrl, validateResourceNames=False)
    else:
        webdavConnection = CollectionStorer(webdavUrl, validateResourceNames=False)

BTW: a few usage examples (like uploading/downloading a few files etc.) would be greatly appreciated.

Regards
Jørgen

description: updated
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.