Bug 48576 - MOVE or COPY in WebDAV fails with 404 when file extension is changed
Summary: MOVE or COPY in WebDAV fails with 404 when file extension is changed
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_dav (show other bugs)
Version: 2.2.3
Hardware: PC Linux
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-19 13:45 UTC by presslab
Modified: 2015-03-11 02:26 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description presslab 2010-01-19 13:45:38 UTC
For example move keepass.kdbx.tmp2 to keepass.kdbx fails with 404, but moving keepass.kdbx.tmp to keepass.kdbx.tmp2 works fine.  This breaks the KeePass program as it uses move in this fashion.

From cadaver:

dav:/webdav/> mv keepass.kdbx keepass.kdbx.tmp
Moving `/webdav/keepass.kdbx' to `/webdav/keepass.kdbx.tmp':  succeeded.
dav:/webdav/> mv keepass.kdbx.tmp keepass.kdbx.tmp2
Moving `/webdav/keepass.kdbx.tmp' to `/webdav/keepass.kdbx.tmp2':  succeeded.
dav:/webdav/> mv keepass.kdbx.tmp2 keepass.kdbx
Moving `/webdav/keepass.kdbx.tmp2' to `/webdav/keepass.kdbx':  failed:
404 Not Found
dav:/webdav/> ls
Listing collection `/webdav/': succeeded.
        KeePass.zip                      6164267  Dec 26 16:25
        keepass.kdbx.tmp2                  38206  Jan 18 16:50
dav:/webdav/>
Comment 1 Stefan Fritsch 2010-01-29 15:13:57 UTC
Is something logged in the error log?

Make sure you have disabled MultiViews for the /webdav directory.
Comment 2 presslab 2010-01-31 09:24:51 UTC
(In reply to comment #1)
> Is something logged in the error log?
> Make sure you have disabled MultiViews for the /webdav directory.

There was nothing in the error log when I received that 404 reply.

I have disabled MultiViews and it solved the problem!  Apparantly KeePass changed the way it saves in version 2.09.

http://kerkhove.net/glob/1/2009-11-29/hello-world.html/comment-page-1

I read about MultiViews and it doesn't seem like it should break anything that KeePass does.  It should only look for other files if the requested one does not exist.

http://httpd.apache.org/docs/2.0/mod/mod_negotiation.html

It still seems like a bug, yes?

Thanks for your help!
Comment 3 Wim Lewis 2011-05-02 18:50:14 UTC
I agree that this seems like a bug. The WebDAV WG decided not to try to figure out the right interaction between DAV and content negotiation, so it's probably best to just disable MultiViews on a DAV directory, but Apache's current behavior seems unambiguously wrong.

The general case that causes this problem for me is MOVEing a collection to a destination URL which is only mapped as a result of content-negotiation. For example, if I have file Foo.txt and collection Bar, then moving Bar to Foo will fail with 404.

IMHO Apache should do one of:

1: Fail with 412 if Overwrite: F was sent; succeed if Overwrite: T was sent.
2: Succeed whether or not Overwrite: T was sent (on the theory that you're not overwriting anything)
3: Fail with another 4xx error code such as 409 Conflict.

I think #1 is probably most correct. #2 is probably closest to what most clients want, but I don't think it is truly correct from a webdav point of view: The Foo resource does actually exist, even though "overwriting" it does not result in the loss of any data.

#3 would be a compromise to keep Apache's current behavior but return a more accurate error code.
Comment 4 Wim Lewis 2015-03-11 02:26:09 UTC
This bug/behavior seems to still exist in 2.4.12, even with various settings of MultiviewsMatch.

For example, in a directory in which thing2.txt.en exists, and with mod_negotiation and mod_mime applied:

dav:/> cat thing2.txt.en
Displaying `/thing2.txt.en':
The contents of a thing. Random number: 917
dav:/> cat thing2.txt
Displaying `/thing2.txt':
Failed: 404 Not Found
dav:/> cat thing2
Displaying `/thing2':
Failed: 404 Not Found
dav:/> mv thing2.txt.en thing2
Moving `/thing2.txt.en' to `/thing2':  failed:
404 Not Found
dav:/> mv thing2.txt.en thing2.txt
Moving `/thing2.txt.en' to `/thing2.txt':  failed:
404 Not Found

But, with MultiViews disabled:

dav:/> mv thing2.txt.en thing2.txt
Moving `/thing2.txt.en' to `/thing2.txt':  succeeded.
dav:/> mv thing2.txt thing2
Moving `/thing2.txt' to `/thing2':  succeeded.