Closed RAYs3T closed 3 years ago
thank you for the excellent bugreport. at the moment i have no time left, to do some fixes. your welcome to fix this issues.
I'll dig around a little on the weekend!
sound good. if you stuck, drop me i line an i'll try to help you.
Okay, so i can confirm that the call invoking the request via the HTTP client indeed includes the correct file (with content). if you look at the contents of the reader, the correct file is streamed.
This makes me think that this might be really an issue on Nextclouds site. But what I don't get is why the upload with cyberduck for example works. Maybe its something with the headers set...
does curl
work?
@RAYs3T any progress?
Sorry for the late response. It seems like this is somehow involving the reverse proxy which you're using in your setup. Since I switched my nextcloud instance from apache2 to nginx and configured some extras, it's working fine.
Here the issue description: https://trac.cyberduck.io/wiki/help/en/howto/mount/issues/fastcgi
And this is what you have to configure in nginx https://github.com/photoprism/photoprism/issues/443#issuecomment-685608490
So this isn't an issue with the client - Maybe just how the error is handled.
I ran into this issue and I think I got to the bottom of it as well: reverse proxies which have issues with chunked encoding. In my case however, the target WebDAV server (a Nextcloud) can't be modified/the setup can't be changed, which blocked use of this library for me.
Anyways, to fix, I've added an interceptor to Client.put
:
rs, err := c.req("PUT", path, stream, func(rq *http.Request) {
b, err := ioutil.ReadAll(rq.Body)
if err != nil {
panic(err)
}
rq.ContentLength = int64(len(b))
rq.Body = ioutil.NopCloser(bytes.NewReader(b))
})
Using this, the upload works fine - I'll fork it for now. I'd recommend adding a Client.SetInterceptor func(interceptor func(method string, rq *http.Request))
API - I could create a PR if this would be an acceptable solution for those like me which are stuck without chunked encoding :)
@chripo I've prepared a PR which resolves this issue.
Describe the bug I discovered a bug in the file upload that has some relation to #20. When uploading a file to Nextcloud, the command succeeds and exits without any error, but the uploaded file has a size of 0 bytes.
Software
To Reproduce
Apache access log (nextcloud)
Expected The file should upload completly or fail with an error
Additional context I initially discovered this issue via PhotoPrism (which uses this client for the uploads). At least one other user is facing the same issue (https://github.com/photoprism/photoprism/issues/443).