android
android copied to clipboard
Auto-Upload - conflict for not-existing files on server side (and upload does not work)
The Auto-Upload worked fine - then I upgraded to Nextcloud Server 23 (from 22 or 21) and also upgraded the Android app.
Since then the app tells me, that every new file is already on the server and does not upload any file.
End of original .htaccess:
ErrorDocument 403 //
ErrorDocument 404 //
I tried to adjust the .htaccess file and removed the redirection to the 404 document (I did not touch this file before!).
ErrorDocument 403 //
# ErrorDocument 404 //
Now the upload seams to work again.
Expected behaviour
- It should upload my images like it did before - without manual hacks
Actual behaviour
- It does not upload any file or picture (without manual hack)
Can you reproduce this problem on https://try.nextcloud.com?
- Did not try yet.
Environment data
Android version: 12 Device model: Samsung Galaxy e10 Stock or customized system: Stock Nextcloud app version: 3.20.2 (F-Droid) Nextcloud server version: 23.0.6
Logs
Web server error log with active ErrorDocument 404 //
cloud.example.com:443 95.115.0.0 - m [21/Jun/2022:15:16:17 +0200] "HEAD /remote.php/dav/files/m//SofortUpload/Camera/2022/06/20220616_140902.jpg HTTP/1.1" 302 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.18.1"
cloud.example.com:443 95.115.0.0 - m [21/Jun/2022:15:16:17 +0200] "HEAD /index.php/apps/dashboard/ HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.18.1"
Web server error log without active # ErrorDocument 404 //
cloud.example.com:443 2a01:c22:: - s [21/Jun/2022:15:21:06 +0200] "HEAD /remote.php/dav/files/s//SofortUpload/Camera/2022/06/20220619_175846.jpg HTTP/1.1" 404 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.2"
cloud.example.com:443 2a01:c22:: - s [21/Jun/2022:15:21:06 +0200] "MKCOL /remote.php/dav/uploads/s/44a7dc43ebef710be21e0a8dcdf20525 HTTP/1.1" 201 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.2"
cloud.example.com:443 2a01:c22:: - s [21/Jun/2022:15:21:06 +0200] "PROPFIND /remote.php/dav/uploads/s/44a7dc43ebef710be21e0a8dcdf20525 HTTP/1.1" 207 786 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.2"
cloud.example.com:443 2a01:c22:: - s [21/Jun/2022:15:21:07 +0200] "GET /index.php/apps/files/api/v1/thumbnail/256/256/SofortUpload/Camera/2022/06/20220619_160719.jpg HTTP/1.1" 200 40630 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.2"
cloud.example.com:443 2a01:c22:: - s [21/Jun/2022:15:21:13 +0200] "PUT /remote.php/dav/uploads/s/44a7dc43ebef710be21e0a8dcdf20525/0000000000000000-0000000007117398 HTTP/1.1" 201 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.2"
cloud.example.com:443 2a01:c22:: - s [21/Jun/2022:15:21:13 +0200] "MOVE /remote.php/dav/uploads/s/44a7dc43ebef710be21e0a8dcdf20525/.file HTTP/1.1" 201 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.2"
cloud.example.com:443 2a01:c22:: - s [21/Jun/2022:15:21:14 +0200] "PROPFIND /remote.php/dav/files/s//SofortUpload/Camera/2022/06/20220619_175846.jpg HTTP/1.1" 207 1150 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.2"
cloud.example.com:443 2a01:c22:: - - [21/Jun/2022:15:21:15 +0200] "GET /index.php/204 HTTP/2.0" 204 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.2"
Seems that I am also affected: https://github.com/nextcloud/android/issues/7905#issuecomment-1164782151 ..
I can confirm that this workaround works.
Do you really have this double slash here? Does it work also if you change it to ErrorDocument 404 /
I just checked the .httacces that ships with nextcloud Server https://github.com/nextcloud/server/blob/master/.htaccess
It does not contain these lines. Does it append stuff from a previous incarnation of this file during installation? If so, this must have been the default settings my hoster put there?
(Edit: Reading the changelogs from my hoster, I even find a mention that the Error Document feature is now available to users - so maybe they made a mistake in the default settings?)
Reading the changelogs from my hoster, I even find a mention that the
Error Documentfeature is now available to users - so maybe they made a mistake in the default settings?
Yeah, that may be possible...
I just checked the .httacces that ships with nextcloud Server https://github.com/nextcloud/server/blob/master/.htaccess
It does not contain these lines.
Hi @Knusper,
I have not added those lines and I'm sure my hoster hasn't not either.
But I found this: https://github.com/nextcloud/server/blob/7acb438e428e5b0b3a79c2b7ce5a4283b0e805eb/lib/private/Setup.php#L490
It looks like Setup.php adds these lines to the .htaccess.
Regards! Stefan
Yeah but does it work with a single slash for you?
Hi @szaimen, there is no difference between ErrorDocument 404 // and ErrorDocument 404 /
I also noticed that, if I make an update of the Nextcloud Server the ErrorDocument 404 // line is added again to my .htaccess file.
Yes, I can confirm. But now I don't get file conflict warnings anymore, the upload of new files just fails with connection error.
I can confirm having the same problem.
Tested by installing a the newest stable server version 24.0.3 via the web installer, installing to the "." directory, using the default SQLite DB and not installing the recommended apps.
The .htaccess file got the line ErrorDocument 404 // added.
When trying to upload a file (not even using the auto-upload), this is shown in the webserver access logs:
[24/Jul/2022:15:03:12 +0200] "HEAD /remote.php/dav/files/admin//IMG_20220123_113042.jpg HTTP/1.1" 302 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
[24/Jul/2022:15:03:13 +0200] "HEAD /index.php/apps/dashboard/ HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
When removing that ErrorDocument line as OP mentioned, it works:
[24/Jul/2022:15:08:53 +0200] "HEAD /remote.php/dav/files/admin//IMG_20220123_113042.jpg HTTP/1.1" 404 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
[24/Jul/2022:15:08:54 +0200] "PUT /remote.php/dav/files/admin//IMG_20220123_113042.jpg HTTP/1.1" 201 0 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
[24/Jul/2022:15:08:54 +0200] "PROPFIND /remote.php/dav/files/admin//IMG_20220123_113042.jpg HTTP/1.1" 207 1173 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
[24/Jul/2022:15:08:55 +0200] "GET /index.php/apps/files/api/v1/thumbnail/256/256/IMG_20220123_113042.jpg HTTP/1.1" 200 27404 "-" "Mozilla/5.0 (Android) Nextcloud-android/3.20.3"
I tried it with an account on https://try.nextcloud.com/ a well. Interestingly it did work there. They are using version 24.0.0 though, but I have also tried specifically with that version and it failed for me. But since that line in .htaccess might not always be added, this is not a good comparison without knowing what exactly they have in that file.
cc @kesselb what do you think about removing the errordocument part in the updatehtaccess function?
Looks related to https://github.com/nextcloud/server/issues/33048
Sorry I don't know why we write ErrorDocument to .htaccess and if we still need it :man_shrugging:
Ah, thanks for pointing this out. My hoster configure the server as described there, and that's why I get this nasty error. Currently the only solution for me is manually editing the .htaccess file after each update.
I can confirm this error and couldn't share i.e. photos from an Android client as in this bug report https://github.com/nextcloud/android/issues/10628. "Solved" via editing the .htaccess file.
Thank you! I couldn't upload files from my phones for months, with your fix it is working again, thanks!
Anything we can do to fix this except edit the HTaccess file? I have a managed Nextcloud instance, so I cannot edit the HTaccess file.
I think this should be solved automatically with nc26...
Well, I have been trying to auto-upload my pictures to an empty InstantUpload folder and I get tons of conflicts and failed uploads, despite having tried 3 times.
Well, I don't think you are running NC26 yet...
My NC version is indeed 25, sorry for that.
Looks related to nextcloud/server#33048
Sorry I don't know why we write ErrorDocument to .htaccess and if we still need it 🤷♂️
Thanks @kesselb : It looks like ProxyErrorOverride On could be indeed the cause of this problem for me.
This was a Server matter: nextcloud/server#33048 and has been addressed in all supported version of NC Server at this point.