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

Crash when uploading a file from seafile android app #758

Closed
markusd112 opened this issue Sep 21, 2018 · 20 comments
Closed

Crash when uploading a file from seafile android app #758

markusd112 opened this issue Sep 21, 2018 · 20 comments
Assignees
Labels

Comments

@markusd112
Copy link

When Choosing "Add" --> "Upload file" the app crashes each time.. Several crash reports via android crash reporting has been already sent.

@markusd112
Copy link
Author

App Version 2.2.6, Android 7.0, Moto G5 Plus

@markusd112
Copy link
Author

The problem occurs, when choosing a file to upload from SD card. When choosing a file stored in internal memory of the smartphone, the upload works...

@ghost
Copy link

ghost commented Oct 3, 2018

same thing happening to me. device Note8 Oreo

@DoS007
Copy link

DoS007 commented Dec 8, 2018

Yeah, and just look at google play store comments. There are plenty, who have the same problem that upload does not work. And that problem does not exists since yesterday, but for months. Is seafile still activley developed?!

Only other option would be to move to nextcloud, but i don't want to yet. Plzz fix, uploading is crucial for an uploading and downloading app. And Android is the consumer most used plattform these days. So please please, fix it.

@freeplant
Copy link
Member

We have fixed a few related issues that causing file uploading crash in recent versions. We will check a again.

@DoS007
Copy link

DoS007 commented Dec 9, 2018

@freeplant I really, really appreciate your fast response 👍 .

Is the version, in which the few related issues are solved, the play store version at this moment? If not, when will it be published in play store?

Edit: I'm using version 2.2.8 (from playstore). And it still has a problem.

On this https://github.com/haiwen/seadroid/releases site, there is only one newer version, which doesn't fix anything according file uploading regaring realese notes.

So the problem still exists. If there is any way to help you, give you logs or something, I would be happy to help.

@Firefly1337
Copy link

@freeplant
I had some time and debugged it, this is for downloading files:
SeafConnection.java#getDownloadLink looks like the following:

HttpRequest req = prepareApiGetRequest(apiPath, params);
checkRequestResponseStatus(req, HttpURLConnection.HTTP_OK);
String result = new String(req.bytes(), "UTF-8");

String fileID = req.header("oid");
// should return "\"http://gonggeng.org:8082/...\"" or "\"https://gonggeng.org:8082/...\"
if (result.startsWith("\"http") && fileID != null) {
    String url = result.substring(1, result.length() - 1);
    return new Pair<String, String>(url, fileID);
} else {
    throw SeafException.illFormatException;
}

prepareApiGetRequest redirects to https://<url>/api2/repos/<repo-id>/file/?p=<file>&op=download which returns, at least on my server, "/seafhttp/files/<repo-id>/<file>".
That value is saved to String result.

The following check (if (result.startsWith("\"http") && fileID != null) {) will not work because it is missing the URL.
Simply adding the URL (retrievable via accounts.server) to String result will make it work.

I have not yet looked at the upload function but I suspect it might be the same issue.
I am unsure wether this is an issue with the server, the app or my specific server config. Given the fact that I am not alone it's either the seafile server or app. Probably the app.

@Firefly1337
Copy link

Found the same issue for SeafConnection.java#getUploadLink.
Added the URL and upload is working fine again.

@Firefly1337
Copy link

I created a PR for this, see #772

@freeplant
Copy link
Member

@Firefly1337 Thanks for debugging the problem. What version of the server do you use? In our API document

GET https://cloud.seafile.com/api2/repos/{repo-id}/file/?p=/foo

should return something like

https://cloud.seafile.com:8082/files/adee6094/foo.c

@freeplant freeplant reopened this Dec 17, 2018
@Firefly1337
Copy link

@freeplant Ah!
I think I know why. I have a bit more complex setup than most. My seafile server is in my LAN serving content using the internal IP address. At the same time it is also accessible via nginx reverse proxy through a VPN from my VPS using a public domain. (My local Seafile VM is also using a reverse proxy but internally on localhost).

Issue is probably because my FILE_SERVER_ROOT contains only /seafhttp. I need this to be a relative path for it to work both via IP and domain. That path is another location of my reverse proxy.
Web client, Seafile desktop and even Seadrive are all working fine like this - except the app.

For me, the issue is clear now. But why are other people having issues uploading/downloading files?
In any case, my code should generally work wether the URL is present or not.

I am using the latest Seafile server 6.3.4 (Community edition).

@DoS007
Copy link

DoS007 commented Jan 20, 2019

I tried another phone with android 8 - there was no problem. Thus the problem seems to be related to android 7 (tested with my smartphone and my tablet - they are using android 7).

I now tested on my android 7 tablet all 2.2* versions (including the newest release at this moment):
2.2.0 upload working
2.2.1 upload working
2.2.2 upload not working
2.2.3 upload not working
2.2.4 upload not working
2.2.5 upload not working
2.2.6 upload not working
2.2.7 upload not working
2.2.8 upload not working
2.2.9 upload not working
2.2.10 upload not working
2.2.11 upload not working

(Switching to seafile during uploading says "Hochladen fehlgeschlagen" or translated "upload failed")

As you can see 2.2.1 is the last working version. So the new changes made in 2.2.2 are faulty.

I hope that knowing the problem is related to android 7 and the problem began in 2.2.2 and there are still many people with android 7 having the problem (look play store page), it is easier for you to fix this now.

If i can do anything to help you, post logs somehow or test if a new release fixes the problem or so, just say, i'm happy to help you.

@alexharnozd
Copy link

Btw, i too have a problem with note 8 android 8.

Auto upload is working. But it wont upload all/completely all the folder images.
Such as whatapps images folder(it will only upload some of it before it stop)
Tried clear caches. Nothing.
Tried few days with in out wifi area. Nothing.
New photos from camera folder. No sync as well

Tried 2.2.1 ~ upload halfway then nothing.
Tried latest version ~ upload halfway then nothing.

Phone is not root. Not sure where to find log from my android phone.

Server : community 6.3.4 raspi
Download and upload manually no problem.
Only auto upload got problem so far

Alex

@DoS007
Copy link

DoS007 commented Feb 18, 2019

@alexharnozd Oh, you think someone will fix that? I don't think so. I'm a bit depressed that nobody did something after my clear information and nobody even commented on that.

For now I just accepted, that android 7 will never work with newer versions and just use the older version for that. For Android 8 newest version is ok.

But anyway, you have android 8, so I suppose it's maybe more a thing of battery optimizing. Go into os deselect seafile for battery optimazation/saving. Does the problem then still appear?

@alexharnozd
Copy link

@DoS007 nothing much we can do on our end. Unless we go deep to the on how and do by ourself which is unlikely. Hahaha

Thanks for you advise. I will give it a try now.

And while for your problem.
I hope someone can assisting you as well.
As you know..
My achievement today till i be able to run seafile + nginx + letsencrypt with my zero IT knowledge consider big project to myself.
And thats all got from community + forum + countless hours of reading.
Zero knowledge somemore linux
I dont even know what does su / sudo / apt iptables / pivpn /dns /opendns /smb /omv/webroor/ ls/ bash / for....
I read, play, edit, test, this is my 4th or 5th installation. HAHAHAHAHAHA

All the best for your problem, really hope someone could assist you for a help/hints

@alexharnozd
Copy link

@DoS007 been trying outbyour way for permission battery optimization and so on to be switch off/ignore for seafile apps.
However same thing happened.
It doesnt sync till finished.
Could it be my photos files too much from whatapps?
I tried many folders of photo
Such as family trip, family photos, some project photos.
It does came out with the folder as ussual but doesnt contained photos. Most of the folder.
Would say it does syncing.it was just not long enough to upload it.
Leave my phone charge wifi overnight.
And the last sync/uploaded was 8 hours ago.
Camera foldee sync arnd 30% of it.
Whatapps image sync 10% of it. Other sync 5% of it
The rest empty folder.

@alexharnozd
Copy link

alexharnozd commented Feb 23, 2019

#758 (comment)

Hi @DoS007,

I actually tried out 2.2.13 android to my wife phone.
Android 7 note 5 (32g)
For daily auto sync between all her folders photos abd videos about a week ago
It counted about 13g to my server.
Its actually work as it should.
Maybe upload could be stop somewhere.
But i does continue some other times.
Till all files being uploaded.

While for me.
I found a problem when i upload 9999 photos from whatapps.
It stop uploading after uploaded 2000++.
Clear cache and data. Hoping that it will resume some other times.
So far it has uploaded around 40g consist of my photos and video from my note 8.

Edit : i follow yoir advise by switching off battery optimisation by ignored seafile apps on my phone.
And i sync 1 folder(1000 photos) by 1 folder(2000 photos)
While for 100+ photos folder i can just uploads it at the same times
Hope this will help you.

Alex

@DoS007
Copy link

DoS007 commented Feb 23, 2019

@alexharnozd don't know why this is happening

@fredleeflang
Copy link

My Android app version 2.2.14 also crashes. Is there anything I can do to help debug? My seafile server is behind a fritzbox router and an Apache proxy.

@r4dh4l
Copy link

r4dh4l commented Aug 7, 2022

Same here with F-Droid version 2.2.46 (121, added on 2022-07-12) under Android 7.1.1.

@zhwanng zhwanng closed this as completed Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants