mar10/wsgidav

Case-Sensitivity issue on MOVE/COPY actions through Windows DAV

afrench-webworks opened this issue · 3 comments

Describe the bug
When I try to move a file via Windows Explorer DAV (a rename, cut/paste, etc.), my request is rejected and I get a prompt stating "Cannot read file or disk".

To Reproduce
Steps to reproduce the behavior:

  1. Connect to WsgiDAV service via Windows Explorer
  2. Navigate to folder
  3. Try to rename a file
  4. See error

Expected behavior
I expected to be able to rename and move files and directories via Windows Explorer DAV.

Environment:

wsgidav version 4.0.1

Using cheroot, Windows File Explorer

Additional context
I was able to fix this issue by modifying the logic in request_server.py. By lowercasing dest_netloc in the check, it goes through without failing. Seems like it might be important because the strings they are being compared against actually are lowercased when assigned.

request_server.py, method _copy_or_move

From:

        if dest_scheme and dest_scheme not in (url_scheme, fwd_scheme):
            self._fail(
                HTTP_BAD_GATEWAY,
                "Source and destination must have the same scheme.\n"
                "If you are running behind a reverse proxy, you may have to "
                "rewrite the 'Destination' haeader.\n"
                "(See https://github.com/mar10/wsgidav/issues/183)",
            )
        elif dest_netloc and dest_netloc not in (url_host, fwd_host):
            # TODO: this should consider environ["SERVER_PORT"] also
            self._fail(
                HTTP_BAD_GATEWAY, "Source and destination must have the same host name."
            )

To:

        if dest_scheme and dest_scheme.lower() not in (url_scheme, fwd_scheme):
            self._fail(
                HTTP_BAD_GATEWAY,
                "Source and destination must have the same scheme.\n"
                "If you are running behind a reverse proxy, you may have to "
                "rewrite the 'Destination' haeader.\n"
                "(See https://github.com/mar10/wsgidav/issues/183)",
            )
        elif dest_netloc and dest_netloc.lower() not in (url_host, fwd_host):
            # TODO: this should consider environ["SERVER_PORT"] also
            self._fail(
                HTTP_BAD_GATEWAY, "Source and destination must have the same host name."
            )
mar10 commented

Please have a look at my commit (slightly different): does it solve the problem?

@mar10 just tested. Looks good. Working on my end. 👍

mar10 commented

thanks - it will land in the next release, hopefully soon