mar10/wsgidav

Can not move or rename files

denchInside opened this issue · 15 comments

I can upload, open and delete any files but I can't move or rename them.
изображение
It says: Can not perform read from file or drive.
The console says 502 Bad Gateway
изображение

and here is my config file
config.yaml.txt

mar10 commented

I cannot read the dialog message, please translate.
Also provide a log file in debug/verbose mode.
Generally, 502 is raised in these cases:

        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."
            )
        elif not dest_path.startswith(provider.mount_path + provider.share_path):
            # Inter-realm copying not supported, since its not possible to
            # authentication-wise
            self._fail(HTTP_BAD_GATEWAY, "Inter-realm copy/move is not supported.")

mar10 commented

We can reopen if it turns out to be a bug

I cannot read the dialog message, please translate. Also provide a log file in debug/verbose mode.

Well, the dialog says:
Can not perform read from file or drive.
Try again Skip Cancel
And it happens when I try to move any file.
And here is the piece of log where the exception is caught:
log.txt

    elif not dest_path.startswith(provider.mount_path + provider.share_path):
        # Inter-realm copying not supported, since its not possible to
        # authentication-wise
        self._fail(HTTP_BAD_GATEWAY, "Inter-realm copy/move is not supported.")

Here is my case of exception, but I don't understand what is it about and why it happens. Maybe this is one of many Windows's fault?

mar10 commented

You are moving a file from one realm (/) to another (/private), which is currently not supported:

provider_mapping:
    '/private': '/mnt/share/'
    '/':
        root: '/mnt/share/public/'
        readonly: true
13:29:57.206 - INFO    : 192.168.0.144 - (anonymous) - [2022-01-16 13:29:57] "MOVE /public/config.yaml.txt" dest="http://192.168.0.172:8080/private/public/%D0%9F%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D1%8B/config.yaml.txt", length=0, overwrite=F, connection="Keep-Alive", agent="Microsoft-WebDAV-MiniRedir/10.0.17763", elap=0.002sec -> 401 Not Authorized
13:29:57.226 - DEBUG   : Raising DAVError 502 Bad Gateway: Inter-realm copy/move is not supported.
mar10 commented

Currently, the authentication realm is calculated from the provider share path, so we have two realms.

A solution could be to make the realms configurable.

A solution could be to make the realms configurable.

Sorry, I don't understand how to make the realms configurable and what do I need to change in their config.

mar10 commented

It is not configurable yet. I reopened this ticket, because this would be an new feature to be implemented.

Thank you for response

I've just noticed, that I can't move any files even if I have only one realm. It always gives the described error.

mar10 commented

You are still trying to move between two realms /shara/... -> /private/shara/...:

08:28:43.134 - INFO    : 192.168.0.144 - (anonymous) - [2022-01-17 08:28:43] "MOVE /shara/testFile" dest="http://192.168.0.172:8080/private/shara/renamedFile", length=0, overwrite=F, connection="Keep-Alive", agent="Microsoft-WebDAV-MiniRedir/10.0.17763", elap=0.002sec -> 401 Not Authorized
08:28:43.150 - DEBUG   : Raising DAVError 502 Bad Gateway: Inter-realm copy/move is not supported.

one is anonymous, one requires authentication:

08:05:08.243 - INFO    : Registered DAV providers by route:
08:05:08.244 - INFO    :   - '/:dir_browser': FilesystemProvider for path '/usr/local/lib/python3.9/dist-packages/wsgidav/dir_browser/htdocs' (Read-Only) (anonymous)
08:05:08.244 - INFO    :   - '/private': FilesystemProvider for path '/mnt/share/private' (Read-Write)
08:05:08.245 - INFO    :   - '/': FilesystemProvider for path '/mnt/share' (Read-Write) (anonymous)

The problem was caused by mount_path: '/mnt/share/private'. Thank you for help!

This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs.
Thank you for your contributions.

i dont understand nothing, i have the sample problem in windows, the docs are hard to understand T_T, someone have a .yaml example for windows? I cant write files, only write folders and read names. but not can write data.