-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[BUG] Text (.txt) file won't download / open in Android App #4352
Comments
Hi @geobzmm! Thanks a lot for the info! We'll take a look ASAP and will let you know news about this in this thread 🍻 |
I have the exact same problem with four different devices and v4.2.1 (I downgraded one to v4.2.0, but this did not make a difference), but with all tested data types (*.ogg, *.txt, *.jpg)
Webfrontend and Desktop-Sync are working fine. This makes the Owncloud-App completely unusable for me. |
will do a look here. Meanwhile, you can use the "open with" option to open with 3rd party apps (changes will sync to the server as well) |
Thank you for taking your time to look at this. Unfortunately using "open with" does not work either. I get the same small popup "Herunterladen fehlgeschlagen" (Download failed) at the bottom of the screen before it asks what app I want to open the file with. Let me know if I can assist you in any way with debugging this. |
Hello, No way to access to my files Everything is working on the PC or web client. Thks for you help |
After lot of tests, I found the solution (in my case) But with apache php: |
@jesmrec Unfortunately this is not a solution for me as I am running several different virtual servers that need to run under different users. I don't think this is configurable with mod_php so I need to use php-fpm. |
This could be related: https://central.owncloud.org/t/download-failed-unknown-error/47935 |
That is my post over at ownCloud Central. I can confirm that the files I tested were text files (markdown, specifically). I also have been using PHP-FPM with my ownCloud instance for many years and cannot substitute mod PHP. |
Might worth to mention that OP is using / running:
but other users mention php-fpm bot oCIS doesn't use PHP so this could be something different or even independent from the underlying server variant (oCIS vs. ownCloud 10). Also not even sure if using php-fpm is officially supported for the PHP variant of ownCloud. |
It works for me as well. But I had to put it in the .htaccess file in my owncloud-data folder as it is not a subfolder of the owncloud folder. |
Hey @chaotix- , @JohnHardline, @iasdeoupxe, @dapkdapk, @Noni006 glad you found a solution, that seems to be server-related. Could you tell us which server version are you using? So that we can locate the error more easily and maybe solve whatever we need to solve from our side if needed |
@DeepDiver1975 all these problems seem to be related with an incorrect received |
Side note: php-fpm is NOT supported with OC10. You're on your own. You can use a docker environment to setup ownCloud using the official docker image in an isolated way so it doesn't disturb the rest of your installation. As for oCIS, please try to upgrade to 5.0.3 because it might be fixed there. It could be a server-side issue. |
Hi @JuancaG05 , this is my owncloud server version and php info lines below. Hope that helps.
|
IF the users running the PHP version of ownCloud are really having the same problem as the OP using the non-PHP OCIS then it is really surprising how this should be a server side issue if two completely different technologies suddenly causing the very same issue and one requires an update (OCIS) while the other requires server side modifications in the PHP configuration (OC 10). Sounds more that something changed on the client side (be it in the app itself, in a library or in Android). |
Just wanted to add that since about a week's time I was facing the same problem (all filetypes affected, on multiple android phones) and adding the SetEnv to the (main) .htaccess file solved the issue. |
i get your point and this is also surprising for us. Last app version is two months ago, and server version the same. No changes in last week or last three weeks. Keep checking... |
@iasdeoupxe the common problem is that the server isn't sending the content-length header, or it sends it with a 0 length. For OC10, as far as I know, the issue happens only with php-fpm, which, as said, it isn't supported. PHP as apache module (I think it's apache prefork) works fine (#4352 (comment)) For oCIS, the client logs show the same issue: content-length header seems to be 0 for a 207 HTTP response. I don't know the conditions for the server to send that kind of response, but there have been changes in this regard, so it's possible that the issue is solved in recent oCIS versions. As for the android app, it has problems if the content-length of the downloaded file doesn't match the actual content. If the code didn't change, either the problem was there the whole time but nobody hit it, or android changed something about how downloads are handled if there is a mismatch with the content-length. |
In addition, I'd recommend to anyone having this issue (and posting here) to provide the environment data (check the opening post). The issue was posted for an android v13 phone, which is a relatively recent version. If everyone is having the issue with that version, we could narrow down the problem. |
I have the same problem. Specs: Android 14 Server: Ocis 5.0.3 Logs:
|
@appiekap653 did you notice the error recently? did you update the app? |
I just installed owncloud for the first time yesterday. |
I just checked if downloading the same file was working with the web-client and that worked without problems. Maybe I must also mention that the file was uploaded with the automatic photo upload function of the android app to a folder in a space. |
did you try to download a file in test server (ocis.owncloud.works)? |
Great to here you can reproduce it now. Do you still need my server to test? So it would be nice if you let me know if you still need it as soon as possible. So I can re-enable my security. |
@appiekap653 please reenable, Don't be unsafe. We'll keep all of you up to date. @jvillafanez can reproduce, so that we can go with his env. Thanks a lot for letting us using your instance. |
@jvillafanez hm when I debug a GET request the httpRes Headers that are copied with copyHeader(w.Header(), httpRes.Header) they already contain the 👀 reading up on traefik compression, Content-Length and Accept-Encoding headers. Found: traefik/traefik#7040 (comment) and that Transfer-Encoding in removed in HTTP/2. AFAICT traefik will compress the ocis response, set a |
@geobzmm regarding PHP in the url. We are just providing the same URLs for backwards compatability. Actually, the Also, I'm a little worried about HTTP/2 and traefik dropping the Content-Lenght when enabling the compression middleware. AFAIK clients rely on the Content-Length header ... we need to investigate, but please disable compression for now to be on the safe side. |
@butonic when sending the header Accept-Encoding Identity, Traefik shouldn't compress the response with gzip. |
Quoting https://pkg.go.dev/net/http#ResponseWriter
So golang automatically adds the content-length header for small files, but it doesn't for big files. As seen in #4352 (comment) I don't think we're actively sending the header, so we could be relying on golang automatically sending the header (which don't work for big files) or on traefik doing some magic (which might depend on specific configuration) |
ok, stepping through the GET code with a 7k file we indeed return no Content-Length header. @appiekap653 @jvillafanez so that is only another reason why the Content-Length header might be missing. IMO clients cannot rely on it as the filesize as it actually only describes the length of the body, which might have been encoded in a different lenght. In propfinds owncloud introduced the now ... since HTTP/2 no longer mandates Content-Length ... should we still set it to the file length? even if it does not match the body length? Lets's look at the HTTP2 spec 8.1.2.6. Malformed Requests and Responses:
Ok, what is the 'payload length' of a DATA frame? Go read 4.1 Frame Format and 6.1 DATA. I'll wait here. Now. AFAICT the Content-Length header, if present, has to match the sum of the length of all DATA frame payloads. Transfer encoding is forbidden in HTTP/2 ... What about 8.4. Content-Encoding? Seeing this:
And 8.6. Content-Length with
We MUST NOT set Content-Length to the size of the file as it may not represent the filesize expected by the client. This also applies to the ETAG, and we had problems when enabling compression back in the day: owncloud/core#9005 For etags we introduced AFAICT we need to introduce a
AFAIU the android check tries to ensure all bytes have been received. HTTP/2 as an END_STREAM frame for that. AFAICT even if we set Content-Length to the uncompressed file length as @jvillafanez did in #4352 (comment) treafik would drop it for HTTP/2, anyway. IMO the android app needs to learn how to handle HTTP/2 content length ... I don't see a reason to introduce a new |
Just one thing: as far as I know, the android client doesn't support HTTP2, so all the requests are HTTP1.1. Not sure about the rest of the clients. HTTP2 might be handled by traefik at the moment. Basically, a client sends a HTTP2 request to traefik (assuming it's supported on both sides) and then traefik sends a HTTP1.1 request to oCIS (otherwise, I'm not sure how you have a HTTP2 response from traefik, but an HTTP1.1 one if it's accessed directly to oCIS) The android client is doing an HTTP1.1 request with an It also might be a good idea for the android client to check for the As for how all of this will work with HTTP2, at least for the android client I'd say "not supported at the moment". |
@jesmrec @butonic The iOS client just relies on the HTTP client layer baked into the OS. That layer handles Therefore, the iOS client does not need to (and doesn't) use the value of the On a more general note, expect that enabling compression will regularly lead to chunked responses because the transferred data is typically compressed on the fly and sent in chunks, rather than compressed as a whole before being sent. |
Thanks for clarifying @felix-schwarz. If you don't use We do need to know the total size of the file to be able to show the progress of the download (in a progress bar, for example). |
Maybe, instead of a progress bar, you could just show the number of bytes written on the phone. This way, you can show progress (by increasing the number), and you don't need to know the final content length nor whether the content is compressed. Same with iOS, I expect you to write the uncompressed data (coming from the OS / library) regardless of how the transfer is done (compressed or not). Advantages:
Just a little remark: this would show bytes written, not transferred. If we can know the size of the file, we could also enhance the UX with something like |
@JuancaG05 Yes, the file size, like the Etag that's sent with By sending the Etag for the file from the last
Receiving a newer/different version of the file than what the last
|
Thanks everyone for your inputs. So, i think we should keep trusting
Moving to http2 is not an option today to fix the problem mentioned in first message, probably it'll take longer to do, but we'll put it in our minds. Also, using |
Hey, I just uploaded an APK with a potential fix for this problem. Could you test it to see if it works for you? 🙂 Link: https://infinite.owncloud.com/s/AXxVvNToDiqtMxd |
For me that works now |
What about the rest? Could you take a minute to test it? 😄
@geobzmm @chaotix- @Noni006 @linkp @dapkdapk @iasdeoupxe @JohnHardline @NoSilentRunning @peterjpierre @ whoever wants to test it? 👀 |
I can confirm it is working now as well ... will there also be a corrected version for iPhone? |
are you reproducing this in iOS as well?? |
A friend of mine has an iPhone and he has the same problem not being able to download / open files |
Not sure if it'd be the same problem, because the iOS app prevents the situation we fixed (check here how it works). In any case, it'd useful to create an issue in the iOS open repo with all details as posible, so that @felix-schwarz could take a look. Here the topic should be the Android app. Thanks for testing! |
Well, this is already sent to Google for review and very soon it will be available in the Play Store, becoming the 4.2.2 version of the app. Thanks to everyone who was involved here, but specially to the community for reporting, helping and collaborating with us! ❤️ Closing this ticket, but in any case, if you keep reproducing it with the new 4.2.2 version or whatever, feel free to open a new issue! |
Actual behaviour
Creating a .txt file on another device containing a few words or some notes in a accessible folder then syncs as expected to all devices - server, laptop, desktop and Mobile / Cell. the .txt file can be opened / viewed on server, laptop (win 10), desktop (win 11) but Android App displays message "Download Failed". All other "document" formats appear to work fine (eg. .pdf, .docx, .xlsx, .doc etc...).
Expected behaviour
The .txt file should open and show the text in the file or be downloadable to the Android device (neither of which is possible).
Steps to reproduce
Can this problem be reproduced with the official owncloud server?
(url: https://demo.owncloud.org, user: test, password: test)
Not tested on Official Server
Environment data
Android version: v13
Device model: Samsung Galaxy S20+5G
Stock or customized system: Stock One UI v5.1
ownCloud app version: v4.2.1
ownCloud server version: Infinite Scale Community v4.0.3 running webclient v7.1.2
Logs
ownCloud App Log (data/owncloud.log)
The text was updated successfully, but these errors were encountered: