COPY a `file` to recevied share `folder` returns 412 Pre condition failed - lost share mountpoint in `me/drives`
Describe the bug
copying the file inside Shares folder returns 412 Pre condition failed
Steps to reproduce
Steps to reproduce the behavior:
- As user
Marieshare a foldertestto userEinstein - As user einstein create a file
testFile.txtand accept the share - copy the file to
Shares/test/curl -X COPY -u einstein:relativity https://localhost:9200/remote.php/webdav/testFile.txt \ -H "Destination: https://localhost:9200/remote.php/webdav/Shares/test/" -vk
Expected behavior
The copy is successful with 204 like in OC10 and test folder is over-written by the content of copied file
curl -X COPY -u Alice:123456 http://localhost/core/remote.php/webdav/textfile1.txt \ -H "Destination: http://localhost/core/remote.php/webdav/Shares/test/" -v
* Trying 127.0.0.1:80...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 80 (#0)
* Server auth using Basic with user 'Alice'
> COPY /core/remote.php/webdav/textfile1.txt HTTP/1.1
> Host: localhost
> Authorization: Basic QWxpY2U6MTIzNDU2
> User-Agent: curl/7.68.0
> Accept: */*
> Destination: http://localhost/core/remote.php/webdav/Shares/test/
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 204 No Content
< Date: Wed, 25 May 2022 09:49:55 GMT
< Server: Apache/2.4.41 (Ubuntu)
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 0
< X-Robots-Tag: none
< X-Frame-Options: SAMEORIGIN
< X-Download-Options: noopen
< X-Permitted-Cross-Domain-Policies: none
< Set-Cookie: oc5soe2gvutv=5ep6e8o9knuo8cgvvq54gbqm6c; path=/core; HttpOnly; SameSite=Strict
< Expires: Thu, 19 Nov 1981 08:52:00 GMT
< Cache-Control: no-store, no-cache, must-revalidate
< Pragma: no-cache
< Set-Cookie: oc_sessionPassphrase=rADPXDAttEjpzm%2FlGwB%2BwWQYhoJyYvGt09X6deM%2BjFgaaAa3cnM9R4%2B9WCBE0qexpoPnctMtplACnO9Psil4d%2BBIwE1iWAHbBJerb7HZu9sm6TQU%2Ba%2BbKMvQ3KpziOqX; expires=Wed, 25-May-2022 10:09:55 GMT; Max-Age=1200; path=/core; HttpOnly; SameSite=Strict
< Content-Security-Policy: default-src 'none';
< Set-Cookie: oc5soe2gvutv=0rcd3j8ga96crbqlpdqcb25kts; path=/core; HttpOnly; SameSite=Strict
< Set-Cookie: cookie_test=test; expires=Wed, 25-May-2022 10:49:55 GMT; Max-Age=3600
< OC-FileId: 2147719937oc5soe2gvutv
<
* Connection #0 to host localhost left intact
Actual behavior
Returns with 412 Precondition Failed but a similar request passes if it is for folders that aren't shared and belong to user's personal space
curl -X COPY -u einstein:relativity https://localhost:9200/remote.php/webdav/testFile.txt \ -H "Destination: https://localhost:9200/remote.php/webdav/Shares/test/" -vk
* Trying 127.0.0.1:9200...
* Connected to localhost (127.0.0.1) port 9200 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.2 (IN), TLS header, Supplemental data (23):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.2 (OUT), TLS header, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
* subject: O=Acme Corp; CN=OCIS
* start date: Aug 21 10:03:10 2023 GMT
* expire date: Aug 20 10:03:10 2024 GMT
* issuer: O=Acme Corp; CN=OCIS
* SSL certificate verify result: self-signed certificate (18), continuing anyway.
* Server auth using Basic with user 'einstein'
* TLSv1.2 (OUT), TLS header, Supplemental data (23):
> COPY /remote.php/webdav/textfile0.txt HTTP/1.1
> Host: localhost:9200
> Authorization: Basic ZWluc3RlaW46cmVsYXRpdml0eQ==
> User-Agent: curl/7.81.0
> Accept: */*
> Destination: https://localhost:9200/remote.php/webdav/Shares/test/
>
* 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 412 Precondition Failed
< Access-Control-Allow-Origin: *
< Content-Length: 0
< Content-Security-Policy: default-src 'none';
< Date: Mon, 21 Aug 2023 10:15:07 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/rLnTbi8eJa-000818
< X-Robots-Tag: none
< X-Xss-Protection: 1; mode=block
<
* Connection #0 to host localhost left intact
Setup
Please describe how you started the server and provide a list of relevant environment variables.
OCIS_VERSION=vX.X.X
BRANCH=vX.X.X
STORAGE_FRONTEND_UPLOAD_DISABLE_TUS=false
Additional context
Add any other context about the problem here.
@SwikritiT @kulmann @fschade which impact does that have for the WebUI and the user? If none, please close.
@SwikritiT @kulmann @fschade which impact does that have for the WebUI and the user? If none, please close.
There are tests that are linked to this issue in expected to fail. https://github.com/owncloud/ocis/blob/3f80c8831d187b0b2bdf6baedf61c64b12b0be4b/tests/acceptance/expected-failures-API-on-OCIS-storage.md?plain=1#L1347-L1354
If this won't have any impact on the user I can skip those tests for ocis and remove them from expected to fail
@micbar @kulmann
There are tests related to copy for overwriting while copying (file - folder or folder-file) in core. These API tests seems to behave differently in core and ocis for (new and old webdav). https://github.com/owncloud/ocis/issues/3874#issuecomment-1184048940 and https://github.com/owncloud/ocis/issues/1239 are the tests related to it. With a copy request, overwriting with new and old gives 204 for some and 404 for some tests but the request actually declines the share (irrespective of the status code.)
Since i was shifting all the tests related to /Shares from core to ocis. The same tests above when using spaces webdav for copy request overwriting is forbidden 500 (for file-folder) and 403 (for folder-file). These cannot be done with UI. So i need some information regarding it. I could also show steps to reproduce if you want.
NOTE: This is related to copying from Personal to /Shares
Re-tested, HTTP status code return 412 Pre condition failed. Still, it's different than oc10 but could be expected behavior.
I have updated the title and the description to match the current behaviour
:exclamation: Current behaviour: after performing COPY, the share drive (share mountpoint) got lost while listing the me/drives
Steps to reproduce
-
admin, share a folderadminFolderwithdemouser -
demo, create a folderlorem.txtin Pesronal space -
demo, try to COPYlorem.txtto received shareadminFolderfrom admincurl -XCOPY "https://localhost:9200/dav/files/demo/lorem.txt" \ -H"Destination: https://localhost:9200/dav/files/demo/Shares/adminFolder" \ -udemo:demo -vk< HTTP/1.1 412 Precondition Failed -
demo, check the drives list: noadminFoldershare drive :x:curl "https://host.docker.internal:9200/graph/v1.0/me/drives" -udemo:demo -vk | jq -
demo, check the sharedWithMe list:adminFoldershare is listed :heavy_check_mark:curl "https://host.docker.internal:9200/graph/v1beta1/me/drive/sharedWithMe" -udemo:demo -vk | jq -
admin, check the file permissions - share entry is there :heavy_check_mark:curl "https://host.docker.internal:9200/graph/v1beta1/drives/{admin-drive-id}/items/{adminFolder-id}/permissions" \ -uadmin:admin -vk | jq
Closing in favor of https://github.com/owncloud/ocis/issues/9753