Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebDAV: MKCOL in non edit shared folder returns HTTP result code 201 #2127

Closed
dragotin opened this issue Mar 6, 2013 · 10 comments
Closed

WebDAV: MKCOL in non edit shared folder returns HTTP result code 201 #2127

dragotin opened this issue Mar 6, 2013 · 10 comments

Comments

@dragotin
Copy link
Contributor

dragotin commented Mar 6, 2013

This is about a read-only shared folder, that appears in the Shared directory. If I do the WebDAV command MKCOL there to create a new directory, the server replies with status code 201, which means created. However, the directory is not created, which is correct, because the share is read only. But the server should rather return with 403 Forbidden for example.

Easily reproducable with a webdav client, just open a read only shared dir and try MKCOL.

@blizzz
Copy link
Contributor

blizzz commented Mar 6, 2013

Blind guess: what happens if you put "return " in front of this line? https://github.com/owncloud/core/blob/master/lib/connector/sabre/directory.php#L110

@blizzz
Copy link
Contributor

blizzz commented Mar 6, 2013

or probaby not, if it is what is called by DAV/FS/Directory.php then the return value is not considered anyway.

Maybe we need to throw an Exception, i am not too familiar with Sabre. Maybe @icewind1991 or @butonic know better?

@blizzz
Copy link
Contributor

blizzz commented Mar 6, 2013

okay, when more while i am browsing through this.
We could check the return value of the line quoted above and on false either throw Sabre_DAV_Exception_Forbidden (resulting in HTTP 403) or Sabre_DAV_Exception_MethodNotAllowed (HTTP 405) or Sabre_DAV_Exception_PreconditionFailed (HTTP 412). Whatever makes most sense of a general error in this case.

Btw, why does Sabre not implement HTTP 418?

@DeepDiver1975
Copy link
Member

according to http://www.webdav.org/specs/rfc4918.html#METHOD_MKCOL we should return 403

@DeepDiver1975
Copy link
Member

Btw, why does Sabre not implement HTTP 418?

@evert 😄

@evert
Copy link

evert commented Mar 6, 2013

@blizzz
Copy link
Contributor

blizzz commented Mar 6, 2013

@evert I meant it did not found return of 418 (just grep'ed through em files) ;)

@blizzz
Copy link
Contributor

blizzz commented Mar 6, 2013

So instead of \OC\Files\Filesystem::mkdir($newPath) we would write

if(!\OC\Files\Filesystem::mkdir($newPath)) {
  throw new Sabre_DAV_Exception_Forbidden('Could not create directory '.$newPath);
}

Does this work, @dragotin ?

@dragotin
Copy link
Contributor Author

dragotin commented Mar 6, 2013

Does this work, @dragotin ?
Yes, that works. Great!

Please commit that!

@blizzz
Copy link
Contributor

blizzz commented Mar 6, 2013

Great, there you go!

@blizzz blizzz closed this as completed in 6acbadf Mar 6, 2013
blizzz added a commit that referenced this issue Mar 6, 2013
return 403 when mkdir failed on webDAV, fixes #2127
@lock lock bot locked as resolved and limited conversation to collaborators Aug 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants