ramondeklein/nwebdav

DELETE issue

garrysrevenge opened this issue · 5 comments

Hello!

Maybe this is a default behaviour, but when i delete a file but i haven't the permissions for this operation, i'll get an exeption on the server, but the client gets no dialog that this operation can't be done.

Is this right?

The current implementation of the disk-store doesn't check if the service has the permission to remove the file. If the file cannot be deleted (either due to permission or another condition), you'll get an internal server error. You could change the DiskStoreCollection.DeleteItemAsync method and catch the specific exception that is thrown when you don't have permissions. In that case, you could return DavStatusCode.Forbidden instead.

thx for the fast answer!

i tried your suggestion with no luck.
In your DisktoreCollection i added
_return Task.FromResult(DavStatusCode.Forbidden);
in the first line of DeleteItemSync. I never get an forbidden dialog.

Could you confirm that?

The WebDAV redirector has been improved in Windows 10, but I am not sure if it does interpret result-code Forbidden correctly in the current version. But it would be a good idea to have the server return the proper result-code for other clients.

I have updated the NWebDAV source, so it returns HTTP status Forbidden if the user hasn't permission to delete/move the file. Unfortunately, the Windows WebDAV client doesn't do anything with it. But it seems a bit cleaner than returning InternalServerError.