ddvk / rmfakecloud

host your own cloud for the remarkable
GNU Affero General Public License v3.0
789 stars 68 forks source link

WebDav Uploads an Empty File #253

Closed nickian closed 1 year ago

nickian commented 1 year ago

I have NextCloud/webdav set up and I can see files fine and download files. However, when I try to upload a file, it ends up uploading the file, but it's completely empty, 0kb file. Is this a known issue?

Eeems commented 1 year ago

What OS version is your device?

nickian commented 1 year ago

I'm still on 2.15.1.1189

Eeems commented 1 year ago

What version of Nextcloud are you running?

From what I see in the integration, it's extremely straight forward and just writes the filestream to webdav using gowebdav.

https://github.com/ddvk/rmfakecloud/blob/2481ed5221a3fa2fbe4eb461af25ebe3cd26bb48/internal/integrations/webdav.go#L66-L89

Do you happen to have any other information that might be useful? Logs from the device, proxy, and rmfakecloud during an upload might have hints.

nickian commented 1 year ago

I'm running the newest version of Nextcloud (27.0.1). Webdav uploads are working fine when I do it from Cyberduck on MacOS.

I don't see any errors in the logs for Nginx or Nextcloud. For the rmfakecloud Docker log, I just see this. Doesn't look like an error:

time="2023-07-28T20:04:20Z" level=info msg=uploading...
time="2023-07-28T20:04:21Z" level=info msg="[GIN] 2023/07/28 - 20:04:21 | 200 |  1.299046565s |      172.31.0.1 | POST     \"/integrations/v1/cloud/files/root?name=Quick%20sheets&fileType=pdf\""
time="2023-07-28T20:04:21Z" level=info msg="[auth-middleware] UserId: nick deviceId: RM110-150-64960 newSync: false"
time="2023-07-28T20:04:21Z" level=info msg="[webdav] query for: / depth: 1"
time="2023-07-28T20:04:22Z" level=info msg="[GIN] 2023/07/28 - 20:04:22 | 200 |  578.845168ms |      172.31.0.1 | GET      \"/integrations/v1/cloud/folders/root?folderDepth=1\""
time="2023-07-28T20:04:22Z" level=info msg="[auth-middleware] UserId: nick deviceId: RM110-150-64960 newSync: false"
time="2023-07-28T20:04:22Z" level=info msg="[GIN] 2023/07/28 - 20:04:22 | 200 |     137.256µs |      172.31.0.1 | GET      \"/integrations/v1/cloud/files/L1Jlc3VtZSBGdWxsIC0gTmljayBUaG9tcHNvbiAoQ29tcHJlc3NlZCkucGRm/metadata\""
time="2023-07-28T20:04:22Z" level=info msg="[auth-middleware] UserId: nick deviceId: RM110-150-64960 newSync: false"
time="2023-07-28T20:04:22Z" level=info msg="[GIN] 2023/07/28 - 20:04:22 | 200 |     121.898µs |      172.31.0.1 | GET      \"/integrations/v1/cloud/files/L1F1aWNrIHNoZWV0cy5wZGY=/metadata\""
time="2023-07-28T20:05:11Z" level=info msg="setting scopes: intgr screenshare hwcmail:-1 mail:-1 sync:default"
time="2023-07-28T20:05:11Z" level=info msg="[GIN] 2023/07/28 - 20:05:11 | 200 |     332.386µs |      172.31.0.1 | POST     \"/token/json/2/user/new\""
nickian commented 1 year ago

Result is this.

Screenshot 2023-07-28 at 2 15 37 PM
Eeems commented 1 year ago

You might want to change your rmfakecloud logging level since it looks like there is a tiny bit of extra logging at trace level. That said, I don't think it'll give us much more to work with.

Do you happen to have anything in front of rmfakecloud that might be truncating the body of the request? Like a WAF?

nickian commented 1 year ago

Well, it must be something going on at the Nextcloud level. I just tried adding a WebDAV entry for another instance I'm running on Digital Ocean and it uploads to that one just fine. The one that's not working is a locally hosted one, but it's the same version and configured exactly the same using an SSL from Let's Encrypt.

I'll have to play around with it and see if I can figure it out what's going on. Thanks!