tentwentyfour / nextcloud-link

Javascript/Typescript client that communicates with Nextcloud's WebDAV and OCS APIs
MIT License
56 stars 7 forks source link

Empty file contents from uploadFromStream #45

Closed Mangatt closed 2 years ago

Mangatt commented 2 years ago

Hi, this simple upload code fails to upload contents of file. In this case, file is created, no error is emitted, but Nextcloud file size is 0 B.

const stream = fs.createReadStream('test/test.png')
await client.uploadFromStream('/test/test.png', stream)

Versions: nextcloud-link: 1.2.9 nextcloud: 22.2.5 Node: 17.5.0

Anyone has an idea what might be causing this?

Mangatt commented 2 years ago

Strangely, just one direction is problematic, downloading works just fine:

const out = fs.createWriteStream('test/test.png')
await client.downloadToStream('/test/test.png', out)
await finished(out)
Mangatt commented 2 years ago

Ok, never mind, it was caused by server config recommended by Nextcloud. For future reference, it was fastcgi_request_buffering off nginx directive in our case.

kwisatz commented 2 years ago

Thanks you @Mangatt for leaving the information about what caused this problem. We'll try to look into why this is causing problems with the upload stream.