clragon / e1547

A sophisticated e621 browser
https://e1547.clynamic.net/
GNU General Public License v3.0
209 stars 16 forks source link

All posts fail to download #72

Closed IC-Dyllac closed 1 year ago

IC-Dyllac commented 2 years ago

No matter what post I try to download all of them show the message "Failed to download post #(post number)"

e1547 version: 10.1.3 Android version: 10

clragon commented 2 years ago

Hi there,

have you made sure that the app was granted access to the device storage?

you can check the app permissions in the phone settings.

IC-Dyllac commented 2 years ago

Hi, yes, it has permission. I've tried with the google store version and the GitHub build.

Photo of failed download: https://drive.google.com/file/d/1whlub4-vDSVhOJJqzxnOWEv0qvx19VLe/view?usp=sharing

Photo of permissions: https://drive.google.com/file/d/1Aq4HZdDNSWPtzAY_cC5-aNb35nARAWK9/view?usp=sharing

Edit: For readability's sake I've moved the pictures to drive and linked them

clragon commented 2 years ago

Hi there,

I have attached a modified version which allows you to access the app's exception logs in the settings. Could you install it and extract the error for us?

When you are done you can go back to the normal version by triggering an update in the playstore or installing the normal APK download again. You do not have to uninstall the app to install this update or to go back to the normal version.

app-release.zip

IC-Dyllac commented 2 years ago

Hey, sorry for the delay. Here is what the log says: exception occorued: FileSystemException: Creation failed, path = '/sdcard/Pictures/e1547' (OS Error: Permission denied, errno = 13) with trace: #0 _Directory.create. (dart:io/directory_impl.dart:117)

1 _rootRunUnary (dart:async/zone.dart:1434)

#2 Downloading.download (package:e1547/post/data/actions.dart:145) #3 loadingNotification (package:e1547/interface/widgets/snackbar.dart:78) As a side note, I'm seeing that it's trying to write to the SD card. And I do remember that the other apps that wanted to write to the sd card opened a window where I had to give access to the SD card specifically. I attatch a picture of this specific window ![Access](https://user-images.githubusercontent.com/56610544/170846010-4ff3bd01-03c0-48f4-aa43-05fd8b142105.png)
clragon commented 2 years ago

/sdcard on android does not actually mean a physical sdcard in your device - its very weird. it actually means internal storage in this case. and once you have granted storage permissions to e15 it should have access to the internal storage, on all android versions.

in the newest version, 11.0.0 I have changed how we assess the download path on android - I strongly assume it would be the exact same path, but to be sure, could you confirm that this issue is still persisting? do the logs, which are now inbuilt and part of the app, show the same error?

IC-Dyllac commented 2 years ago

Indeed the problem persists.

EXCEPTION | 1:47:23 PM.654

FileSystemException: Cannot copy file to '/storage/emulated/0/Pictures/e1547/f-r95 - 3425822.png', path = '/data/user/0/net.e1547/cache/libCachedImageData/93701250-fb00-11ec-92a9-99d3c70cbf5b.png' (OS Error: Permission denied, errno = 13)

0 _File.copy. (dart:io/file_impl.dart:328)

1 _rootRunUnary (dart:async/zone.dart:1434)

#2 ForwardingFile.copy (package:file/src/forwarding/forwarding_file.dart:26) #3 Downloading.download (package:e1547/post/data/actions.dart:146)
IC-Dyllac commented 2 years ago

I'm not good at programming but I tried doing my own build (debug version, since release failed for reasons) using the fix I read here on stackoverflow by adding the "requestLegacyExternalStorage" to the android manifest, and the file was able to save without issue. I have no idea if it was because of that or because I built a debug version that it didn't fail at saving the file. I think it's worth mentioning it and leave it to your consideration.

In any case, thank you for your hard work.

clragon commented 2 years ago

unfortunately we cannot employ that fix because as the name implies, that option is a piece of legacy code and the google play store will not allow releasing the app with such an option enabled, and it will be ignored on newer android versions.

this issue seems to be related to the Storage Access Framework that google has introduced. I will look into fixing this but what they have created is a huge pain in the ass for all developers (which couldve been solved nicer with no loss of benefits).

clragon commented 1 year ago

this should now finally be fixed. let us know if it is not.

IC-Dyllac commented 1 year ago

I can confirm the issue was fixed