Describe the bug
When you click open on a download of a zim it says "error can't open zim file"
Expected behavior
The zim file should open
Steps to reproduce the behavior:
Environment
Logs
2019-09-06 15:02:36.192 22182-22397/org.kiwix.kiwixmobile E/kiwix: Exception reading article null from zim file
java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] org.kiwix.kiwixlib.JNIKiwixReader.getContent(org.kiwix.kiwixlib.JNIKiwixString, org.kiwix.kiwixlib.JNIKiwixString, org.kiwix.kiwixlib.JNIKiwixString, org.kiwix.kiwixlib.JNIKiwixInt)' on a null object reference
at org.kiwix.kiwixmobile.data.ZimContentProvider$TransferThread.run(ZimContentProvider.java:486)
@macgills Sounds to be a duplicate of #1312 to me
No, very different. This launches the app and then fails to open it
If we support inputStreams/FileDescriptors #56 this gets a hell of a lot easier. The underlying issue is that we get returned "Content Uris" and mapping them to "File Uris" is not easy. We have existing code that makes an attempt but every new FileProvider (chrome/firefox/etc) needs custom dedicated code from what I can surmise.
As a short term solution: the content uri is something like content:///blah/blah.Provider/zimFileName.zim so we could run a fileScan, filter based on the file name and open that, will take slightly longer than just opening a file but feasible. It is fighting the framework a bit.
@macgills Moving to 3.3
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.
@macgills Just to confirm I understand properly. Clicking on a browser download notification opens kiwix properly bus does not share the ZIM file path, but instead a cryptic content URI which does not allow to know where is the ZIM file it represents. If you confirm, I wonder for what is this URI usefull and how you could get a filedescriptor of it?
You can create an InputStream from it or get a AssetFileDescriptor but we can't get a filename as content uris might not even be a local file. ContentResolver is what we need to use to get access to the underlying data but kiwixlib would have to support the data in this format
Here is an example of a dirty hack that we can in no way guarantee will work consistently. It is pretty hideous.
@macgills I think we can afford a proper fix here :)
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.
As this is pending a potentially difficult kiwixlib update I'll move this out of the milestone
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.
@macgills Is this issue specific to a particular zim file only, as I'm now unable to reproduce it, when I download a zim externally and click from browser to open it, it leaves on the libraryFragment(to be specific the screen where downloaded books are present) of kiwix-android but does not open the file in the reader anyways.
PS: The Url of zim given in the issue description no longer exists and tried this with this zim.
it should open in the reader so the issue still exists. This ticket is awaiting an update in kiwixlib that I believe has been prioritised as it relates to a few app features
Here the libkiwix related feature request: https://github.com/kiwix/kiwix-lib/issues/423
Hi, has there been any progress on this bug? So far it's been a total dealbreaker for me. I'm in a bandwidth constrained area so I have another machine elsewhere download .zim files for me, and when I'm physically near it I copy them onto a microSD card to use on my phone or tablet (both Samsung, phone is a SM-G965U, tablet is a SM-T290, both are running v3.4.3 build 623403 from the Google Play store). Doesn't even show up on the Library screen.
@virtadpt Can you please open an other ticket?
Will-do. Sorry 'bout that, I've not been sleeping a whole lot lately.
Done - #2592.