Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-Upload - conflict for not-existing files on server side (and upload does not work) #10423

Closed
habakuk007 opened this issue Jun 21, 2022 · 23 comments

Comments

@habakuk007
Copy link

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"
@habakuk007 habakuk007 added the bug label Jun 21, 2022
@Knusper
Copy link

Knusper commented Jun 23, 2022

Seems that I am also affected: #7905 (comment) ..

@Knusper
Copy link

Knusper commented Jun 26, 2022

I can confirm that this workaround works.

@szaimen
Copy link
Contributor

szaimen commented Jun 27, 2022

Do you really have this double slash here? Does it work also if you change it to ErrorDocument 404 /

@Knusper
Copy link

Knusper commented Jun 27, 2022

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?)

@szaimen
Copy link
Contributor

szaimen commented Jun 27, 2022

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?

Yeah, that may be possible...

@habakuk007
Copy link
Author

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

@szaimen
Copy link
Contributor

szaimen commented Jun 27, 2022

Yeah but does it work with a single slash for you?

@habakuk007
Copy link
Author

Hi @szaimen, there is no difference between ErrorDocument 404 // and ErrorDocument 404 /

@habakuk007
Copy link
Author

habakuk007 commented Jun 29, 2022

I also noticed that, if I make an update of the Nextcloud Server the ErrorDocument 404 // line is added again to my .htaccess file.

@Knusper
Copy link

Knusper commented Jul 15, 2022

Yes, I can confirm. But now I don't get file conflict warnings anymore, the upload of new files just fails with connection error.

@rndph
Copy link

rndph commented Jul 24, 2022

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.

@szaimen
Copy link
Contributor

szaimen commented Jul 24, 2022

cc @kesselb what do you think about removing the errordocument part in the updatehtaccess function?

@kesselb
Copy link
Contributor

kesselb commented Jul 24, 2022

Looks related to nextcloud/server#33048

Sorry I don't know why we write ErrorDocument to .htaccess and if we still need it 🤷‍♂️

@Knusper
Copy link

Knusper commented Aug 13, 2022

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.

@RhizomaticNomad
Copy link

I can confirm this error and couldn't share i.e. photos from an Android client as in this bug report #10628. "Solved" via editing the .htaccess file.

@d-sko
Copy link

d-sko commented Sep 16, 2022

Thank you! I couldn't upload files from my phones for months, with your fix it is working again, thanks!

@TeaDrinkingProgrammer
Copy link

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.

@szaimen
Copy link
Contributor

szaimen commented Mar 6, 2023

I think this should be solved automatically with nc26...

@TeaDrinkingProgrammer
Copy link

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.

@szaimen
Copy link
Contributor

szaimen commented Mar 6, 2023

Well, I don't think you are running NC26 yet...

@TeaDrinkingProgrammer
Copy link

My NC version is indeed 25, sorry for that.

@pokulo
Copy link

pokulo commented Nov 6, 2023

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.

@joshtrichards joshtrichards added hotspot: sync conflicts Sync conflict management matters and removed feature: activity and notification Server activity and notifications labels Nov 16, 2023
@joshtrichards
Copy link
Member

This was a Server matter: nextcloud/server#33048 and has been addressed in all supported version of NC Server at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests