SenseNet / sn-client

Monorepo for sensenet client packages 🐱‍💻
https://sensenet.com
GNU General Public License v2.0
24 stars 37 forks source link

[BUG] Can't overwrite an existing file with a new, empty file #1413

Open hashtagnulla opened 2 years ago

hashtagnulla commented 2 years ago

🐜 Describe the bug

If I upload a file in order to overwrite an existing file (with the same filename) on the server, the backend sends me a HTTP 204 response, but actually it does not modify the old file.

👉 Steps To Reproduce

  1. Upload a file
  2. Upload an empty file with the same name of the first one. You must enable "overwrite" flag.
  3. You should see that the response is OK, but no change has occurred on the server
tusmester commented 2 years ago

The server side seems to be fixed, but now the client throws the following error when trying to upload an empty txt (0 bytes) file on top of an existing file with the same name:

SyntaxError: Unexpected end of JSON input
    at Upload.uploadNonChunked (https://admin.test.sensenet.com/static/js/main.381ee0ec.js:1:381639)
    at async Trace.callMethodAsync (https://admin.test.sensenet.com/static/js/main.381ee0ec.js:1:404499)
    at async Upload.file (https://admin.test.sensenet.com/static/js/main.381ee0ec.js:1:380574)

Repository: https://insql-daily.test.sensenet.cloud