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

can't edit a file to have no content #7115

Closed
nirajacharya2 opened this issue Aug 24, 2023 · 3 comments
Closed

can't edit a file to have no content #7115

nirajacharya2 opened this issue Aug 24, 2023 · 3 comments
Labels

Comments

@nirajacharya2
Copy link
Contributor

nirajacharya2 commented Aug 24, 2023

Describe the bug

if there is a file that contains some text and if we try to edit that text file to have no content it wont let us edit it.

Steps to reproduce

Steps to reproduce the behavior:

  1. create a file in personal space (or any context)
curl "https://localhost:9200/remote.php/dav/spaces/48c79c6f-d733-4783-817b-79396e6a6b9c%244c510ada-c86b-4815-8820-42cdf82c3d51/file.txt" -ueinstein:relativity -vk -XPUT --data ''
  1. write something in that file and save it
 curl "https://localhost:9200/remote.php/dav/spaces/48c79c6f-d733-4783-817b-79396e6a6b9c%244c510ada-c86b-4815-8820-42cdf82c3d51/file.txt" -ueinstein:relativity -vk -XPUT --data 'some data'
  1. now again edit the file to have no text and save it
curl "https://localhost:9200/remote.php/dav/spaces/48c79c6f-d733-4783-817b-79396e6a6b9c%244c510ada-c86b-4815-8820-42cdf82c3d51/file.txt" -ueinstein:relativity -vk -XPUT --data ''

Expected behavior

it should save the file to have no content

Actual behavior

it dose not let the text file to have no content and shows a popup dialog at the bottom right saying

*   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 24 11:01:43 2023 GMT
*  expire date: Aug 23 11:01:43 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):
> PUT /remote.php/dav/spaces/48c79c6f-d733-4783-817b-79396e6a6b9c%244c510ada-c86b-4815-8820-42cdf82c3d51/file.txt HTTP/1.1
> Host: localhost:9200
> Authorization: Basic ZWluc3RlaW46cmVsYXRpdml0eQ==
> User-Agent: curl/7.81.0
> Accept: */*
> Content-Length: 0
> Content-Type: application/x-www-form-urlencoded
>
* 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 500 Internal Server Error
< Access-Control-Allow-Origin: *
< Content-Length: 0
< Content-Security-Policy: default-src 'none';
< Date: Thu, 24 Aug 2023 11:27:14 GMT
< Vary: Origin
< X-Content-Type-Options: nosniff
< X-Download-Options: noopen
< X-Frame-Options: SAMEORIGIN
< X-Permitted-Cross-Domain-Policies: none
< 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 or configuration files.

ocis latest master

Additional context

Add any other context about the problem here.

@phil-davis
Copy link
Contributor

Can an empty file with a new name be created with an API request?
Can an existing file be overwritten with empty content with an API request?

It will be good to know what happens with CURL commands directly to the server API.
That will make it easier to fix the server problem.

@kobergj
Copy link
Collaborator

kobergj commented Aug 24, 2023

I can shed some light on this:
When doing a PUT request with 0 bytes, the server will do a TouchFile instead of an actual upload. Hence the error occurs because the file already exists.

This is a bug, yes. But it is also reproducable on stable-3.0 so it is not a release blocker.

@saw-jan
Copy link
Member

saw-jan commented Dec 18, 2023

Same as #7257 and it is fixed by cs3org/reva#4193

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

No branches or pull requests

4 participants