Getting Error "ERR error getting the content length" if I try to create a markdown or plain text file
Describe the bug
Hello :)
Environment: fresh opencloud deployed via docker compose behind a reverse proxy without collaboration enabled ( COMPOSE_FILE=docker-compose.yml:external-proxy/opencloud.yml ).
Deployment works fine, I even can upload files without any problems, but if I try to create a plain text file or markdown file with the UI, I get the following error in the UI:
X-Request-Id: 3fcad325-dcba-499e-8c6f-a15637cde823
The logs state the following error:
2025-09-23T14:17:57Z ERR error getting the content length error="strconv.ParseInt: parsing \"\": invalid syntax" line=github.com/opencloud-eu/reva/[email protected]/internal/http/services/owncloud/ocdav/put.go:147 name=eu.opencloud.web.ocdav path=/test.txt request-id=12f3c1ab-105b-4873-8c1e-4edd900b66d5 service=ocdav spaceid=69fe058b-f0ae-4489-8cc0-23e16c3398f2$d7a2d46a-2c94-4069-81e0-bb2ec066c973 traceid=8f6efa211d4cff70f4dea0ab002adab4
2025-09-23T14:17:57Z INF access-log bytes=0 duration=13.847264 line=github.com/opencloud-eu/opencloud/services/proxy/pkg/middleware/accesslog.go:34 method=PUT path=/remote.php/dav/spaces/69fe058b-f0ae-4489-8cc0-23e16c3398f2$d7a2d46a-2c94-4069-81e0-bb2ec066c973/test.txt proto=HTTP/1.1 remote-addr=157.180.224.117 request-id=12f3c1ab-105b-4873-8c1e-4edd900b66d5 service=proxy status=400 traceid=8f6efa211d4cff70f4dea0ab002adab4
2025-09-23T14:17:58Z INF access-log bytes=0 duration=0.121994 line=github.com/opencloud-eu/opencloud/services/proxy/pkg/middleware/accesslog.go:34 method=GET path=/index.php/apps/files/preview-service-worker.js proto=HTTP/1.1 remote-addr=157.180.224.117 request-id=0c9d87e00237/55zp4hjxwh-000207 service=proxy status=401 traceid=88cbcfde1ec60a187533f354c49b7b26
2025-09-23T14:17:58Z INF user idp:"internal" opaque_id:"a560ebe7-839d-4a00-8f5d-d58dabd103ac" type:USER_TYPE_PRIMARY authenticated host.name=0c9d87e00237 line=github.com/opencloud-eu/reva/[email protected]/internal/grpc/services/authprovider/authprovider.go:146 pkg=rgrpc service=storage-system traceid=c233cb3a032a6404077a89fafeca6bae
2025-09-23T14:17:58Z INF file download data-server=http://localhost:9216/data host.name=0c9d87e00237 line=github.com/opencloud-eu/reva/[email protected]/internal/grpc/services/storageprovider/storageprovider.go:296 pkg=rgrpc ref={"path":"./43b180ac-5879-430e-aac3-5cbc330fcbe9.json","resource_id":{"opaque_id":"jsoncs3-appauth-data","space_id":"jsoncs3-appauth-data"}} service=storage-system traceid=c233cb3a032a6404077a89fafeca6bae
2025-09-23T14:17:58Z WRN http end="23/Sep/2025:14:17:58 +0000" host=127.0.0.1 host.name=0c9d87e00237 line=github.com/opencloud-eu/reva/[email protected]/internal/http/interceptors/log/log.go:112 method=GET pkg=rhttp proto=HTTP/1.1 service=storage-system size=0 start="23/Sep/2025:14:17:58 +0000" status=404 time_ns=160136 traceid=edc985fcd2f175704ae4921e2cf60dd2 uri=/data/spaces/jsoncs3-appauth-data%21jsoncs3-appauth-data/43b180ac-5879-430e-aac3-5cbc330fcbe9.json url=/43b180ac-5879-430e-aac3-5cbc330fcbe9.json
2025-09-23T14:17:58Z INF access-log bytes=0 duration=6.996671 line=github.com/opencloud-eu/opencloud/services/proxy/pkg/middleware/accesslog.go:34 method=GET path=/index.php/apps/files/preview-service-worker.js proto=HTTP/1.1 remote-addr=157.180.224.117 request-id=0c9d87e00237/55zp4hjxwh-000208 service=proxy status=401 traceid=9ef7708aa2e0894679a240f3f79e08f7
Steps to reproduce
- Deploy opencloud via docker-compose behind a proxy without collaboration enabled
- Create plain text or markdown file
Expected behavior
Create a markdown or plain text file without any errors.
Actual behavior
Described above.
Setup
Please describe how you started the server and provide a list of relevant environment variables or configuration files.
COMPOSE_FILE=docker-compose.yml:external-proxy/opencloud.yml
OC_DOCKER_IMAGE=opencloudeu/opencloud-rolling
Opencloud Version:
- OpenCloud 3.5.0
- OpenCloud Web UI 4.0.0
Additional context
Add any other context about the problem here.
Hello, thanks for the report!
Which reverse proxy are you using? Maybe the issue is there — because using our default proxy, COMPOSE_FILE=docker-compose.yml:traefik/opencloud.yml, works fine for us.
I see the same error message when trying to upload a file with DavX5 using Android Storage Access Framework. Content-Length is 0 in this case. Using wireshark, I confirmed that the incoming request from my reverse proxy (traefik FWIW) to opencloud contains Content-Length: 0, whereas the error message by ocdav suggests that the Content-Length was an empty string. So this seems to get changed by the proxy or some other service of opencloud.
Inside the container's network namespace, I can see that the failing PUT request to ocdav's port 9350 contains a valid Content-Length: 0 header.
I'm not trying to upload an empty file btw., but this happens when DavX5 doesn't know the file size in advance, i.e. when it's uploading a stream. Uploading files with known sizes works as expected. But uploading an empty file may cause the same behavior (haven't tried that).
similar issue