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

COPY a file to recevied share folder returns 412 Pre condition failed - lost share mountpoint in me/drives #3874

Closed
SwikritiT opened this issue May 25, 2022 · 7 comments

Comments

@SwikritiT
Copy link
Contributor

SwikritiT commented May 25, 2022

Describe the bug

copying the file inside Shares folder returns 412 Pre condition failed

Steps to reproduce

Steps to reproduce the behavior:

  1. As user Marie share a folder test to user Einstein
  2. As user einstein create a file testFile.txt and accept the share
  3. 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.

@micbar
Copy link
Contributor

micbar commented Jul 13, 2022

@SwikritiT @kulmann @fschade which impact does that have for the WebUI and the user? If none, please close.

@SwikritiT
Copy link
Contributor Author

@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.

#### [copying the file inside Shares folder returns 404](https://github.com/owncloud/ocis/issues/3874)
- [apiWebdavProperties1/copyFile.feature:452](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/copyFile.feature#L452)
- [apiWebdavProperties1/copyFile.feature:453](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/copyFile.feature#L453)
- [apiWebdavProperties1/copyFile.feature:458](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/copyFile.feature#L458)
- [apiWebdavProperties1/copyFile.feature:478](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/copyFile.feature#L478)
- [apiWebdavProperties1/copyFile.feature:479](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/copyFile.feature#L479)
- [apiWebdavProperties1/copyFile.feature:484](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/copyFile.feature#L484)

If this won't have any impact on the user I can skip those tests for ocis and remove them from expected to fail

@SagarGi
Copy link
Member

SagarGi commented Aug 12, 2022

@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). #3874 (comment) and #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

@amrita-shrestha
Copy link
Contributor

Re-tested, HTTP status code return 412 Pre condition failed. Still, it's different than oc10 but could be expected behavior.

@SwikritiT SwikritiT changed the title copying the file inside Shares folder returns 404 copying the file inside Shares folder returns 412 Pre condition failed Aug 21, 2023
@SwikritiT
Copy link
Contributor Author

I have updated the title and the description to match the current behaviour

@saw-jan saw-jan changed the title copying the file inside Shares folder returns 412 Pre condition failed COPY a "file" to recevied share "folder" returns 412 Pre condition failed Jul 29, 2024
@saw-jan saw-jan changed the title COPY a "file" to recevied share "folder" returns 412 Pre condition failed COPY a "file" to recevied share "folder" returns 412 Pre condition failed - no share mountpoint in me/drives Jul 29, 2024
@saw-jan saw-jan changed the title COPY a "file" to recevied share "folder" returns 412 Pre condition failed - no share mountpoint in me/drives COPY a "file" to recevied share "folder" returns 412 Pre condition failed - lost share mountpoint in me/drives Jul 29, 2024
@saw-jan saw-jan changed the title COPY a "file" to recevied share "folder" returns 412 Pre condition failed - lost share mountpoint in me/drives COPY a file to recevied share folder returns 412 Pre condition failed - lost share mountpoint in me/drives Jul 29, 2024
@saw-jan
Copy link
Member

saw-jan commented Jul 29, 2024

❗ Current behaviour: after performing COPY, the share drive (share mountpoint) got lost while listing the me/drives

Steps to reproduce

  1. admin, share a folder adminFolder with demo user

  2. demo, create a folder lorem.txt in Pesronal space

  3. demo, try to COPY lorem.txt to received share adminFolder from admin

    curl -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
    
  4. demo, check the drives list: no adminFolder share drive ❌

    curl "https://host.docker.internal:9200/graph/v1.0/me/drives" -udemo:demo -vk | jq
    
  5. demo, check the sharedWithMe list: adminFolder share is listed ✔️

    curl "https://host.docker.internal:9200/graph/v1beta1/me/drive/sharedWithMe" -udemo:demo -vk | jq
    
  6. admin, check the file permissions - share entry is there ✔️

    curl "https://host.docker.internal:9200/graph/v1beta1/drives/{admin-drive-id}/items/{adminFolder-id}/permissions" \
    -uadmin:admin -vk | jq
    

@saw-jan
Copy link
Member

saw-jan commented Aug 7, 2024

Closing in favor of #9753

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants