owncloud / ocis

:atom_symbol: ownCloud Infinite Scale Stack
https://doc.owncloud.com/ocis/next/
Apache License 2.0
1.38k stars 182 forks source link

Folders can be locked and locking works partially #7641

Open SwikritiT opened 11 months ago

SwikritiT commented 11 months ago

Describe the bug

As per https://github.com/owncloud/ocis/issues/1284#issuecomment-1238336767 ocis doesn't support locking a folder and doesn't have the plan to do so. Sending a LOCK request to the folder returns success status code and it also partially works. While a user can upload new files inside the folder, they however cannot create a new folder inside a folder that is locked.

Steps to reproduce

Steps to reproduce the behavior:

  1. As user Einstein create a folder locked
  2. Lock the folder locked, this works
    curl -ueinstein:relativity -XLOCK "https://localhost:9200/remote.php/webdav/locked" -H "Content-Type: application/json" -d"<?xml version='1.0' encoding='UTF-8'?><d:lockinfo xmlns:d='DAV:'><d:lockscope><d:exclusive/></d:lockscope></d:lockinfo>" -vk 

    Note that the behaviour is same for dav and dav/spaces

  3. Upload a file inside the folder locked , this works
    curl -ueinstein:relativity -XPUT "https://localhost:9200/remote.php/webdav/locked/textfile.txt" -d"hello world" -vk
  4. Create a new folder inside the locked folder i.e locked/test, doesn't work
    curl -u einstein:relativity -XMKCOL "https://localhost:9200/remote.php/webdav/locked/test" -vk

    Expected behavior

    The request should be successful. As the locking of the folder is not supported.

Actual behavior

The folder cannot be created and the request returns with 423 Locked

> MKCOL /remote.php/webdav/locked/test HTTP/1.1
> Host: localhost:9200
> Authorization: Basic ZWluc3RlaW46cmVsYXRpdml0eQ==
> User-Agent: curl/7.81.0
> Accept: */*
> 
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* Mark bundle as not supporting multiuse
< HTTP/1.1 423 Locked
< Access-Control-Allow-Origin: *
< Content-Length: 278
< Content-Security-Policy: default-src 'none';
< Content-Type: text/xml; charset=utf-8
< Date: Thu, 02 Nov 2023 04:08:03 GMT
< Vary: Origin
< X-Content-Type-Options: nosniff
< X-Download-Options: noopen
< X-Frame-Options: SAMEORIGIN
< X-Permitted-Cross-Domain-Policies: none
< X-Request-Id: swikriti-OptiPlex-3070/1sUYtYpeM4-000261
< X-Robots-Tag: none
< X-Xss-Protection: 1; mode=block
< 
<?xml version="1.0" encoding="UTF-8"?>
* Connection #0 to host localhost left intact
<d:error xmlns:d="DAV" xmlns:s="http://sabredav.org/ns"><s:exception>Sabre\DAV\Exception\Locked</s:exception><s:message>error: locked by create container: error: locked by urn:uuid:7163a1d7-f88e-4cd7-bbaf-99561594f9d7</s:message></d:error>%            

Also, the folder looks like it is locked on the UI level as well

Screenshot from 2023-11-02 10-03-08

Setup

Please describe how you started the server and provide a list of relevant environment variables or configuration files.

```console OCIS: dfc55c39ef167fd4cebf671a8b9e6e9cba7c1508 ```

SwikritiT commented 11 months ago

Hi, @ScharfViktor I have updated this issue, if the folder is not supposed to be locked then I think this behavior as explained in the issue is a bug. Please go through this and you can close the issue if this is not relevant.

ScharfViktor commented 11 months ago

I suggest:

SwikritiT commented 11 months ago

Note that the behavior is the same in public links as well. Public user can lock the folder partially as described in this issue if they have enough permission.