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

Kiwix cannot import ZIM files from the filesystem #4216

Closed
vincent-sparks opened this issue Feb 7, 2025 · 6 comments · Fixed by #4218
Closed

Kiwix cannot import ZIM files from the filesystem #4216

vincent-sparks opened this issue Feb 7, 2025 · 6 comments · Fixed by #4218
Assignees
Milestone

Comments

@vincent-sparks
Copy link

Describe the bug
In the Kiwix app's Library tab, if I tap the + button in the bottom right corner, a file browser opens, and I can select a ZIM file. If I choose a ZIM file, the app responds with a toast message saying "Error: The selected ZIM file could not be found." and does not do anything else.

If I manually open my phone's files app and move the ZIM file to the directory Android/media.org.kiwixmobile.standalone/Kiwix in the phone's storage root (i.e. /storage/emulated/0), then switch back to the Kiwix app and swipe down to reload the library, my new ZIM file appears as expected. I had to figure this out on my own and it is not at all intuitive.

Expected behavior
When browsing for a file to add to the library, the app should either move, copy, or symlink the ZIM file into the directory where it will look for it.

Steps to reproduce the behavior:
Detailed above

Screenshots

Environment

  • Version of Kiwix Android : 3.13
  • Device : Pixel 8
  • OS version : /e/OS 2.6.3-u-20241217455359-official-shiba

Logs
Not sure how to retrieve logs but will be happy to provide them if this problem is not reproducible on other devices.

@kelson42
Copy link
Collaborator

kelson42 commented Feb 7, 2025

@MohitMaliFtechiz At least the error should contain the full ZIM path IMHO.

@MohitMaliFtechiz
Copy link
Collaborator

In the Kiwix app's Library tab, if I tap the + button in the bottom right corner, a file browser opens, and I can select a ZIM file. If I choose a ZIM file, the app responds with a toast message saying "Error: The selected ZIM file could not be found." and does not do anything else.

@vincent-sparks Can you please tell me from where you are trying to open the ZIM file(In which folder and in which storage internal or SD card)? Ahh! you are using the Pixel 8 which does not have the SD card slot, are you using any OTG or external hard drive?

if I manually open my phone's files app and move the ZIM file to the directory Android/media.org.kiwixmobile.standalone/Kiwix in the phone's storage root (i.e. /storage/emulated/0),

If it shows you Android/media.org.kiwixmobile.standalone/Kiwix in this directory it means you are using the full version of our application it can read the ZIM files from other locations of your storage so there is no need to move the ZIM file into the app-specific directory. Have you tried to refresh the library before moving this ZIM file to the app-specific folder?

@MohitMaliFtechiz
Copy link
Collaborator

MohitMaliFtechiz commented Feb 10, 2025

@vincent-sparks Thanks for reporting the issue, can you please try this APK https://drive.google.com/file/d/1x4aIJ7BlYBAfzEH_KtxhWxmiSg83vJYm/view?usp=sharing and let us know that this version of application able to open the ZIM files from your USB or external hard drive? If there is any problem in opening the ZIM file so after trying to open the ZIM file do the following:

  • Go to the Help screen from the sidebar.
  • Click on Send diagnostic report. Then click on Send Details, and it will attach a log file to the email. Put that log file here.

@vincent-sparks
Copy link
Author

vincent-sparks commented Feb 12, 2025

After testing the issue further, I have determined that the issue is not opening files from the internal storage, but from an app that appears in the file selector (don't know what the internal Android name for these is -- apps that present their own virtual filesystems in the file picker). My bad!

Kiwix can open .zim files from my internal storage and from external USB media, regardless of their file path (as long as it is a child of /storage/emulated/0 and not /data), but if I try to open a file from e.g. Termux's internal storage, Kiwix complains it cannot find it. Behavior in all three of these cases (internal storage, external storage, Termux) is identical across this debug build and the public build on GitHub I was using before.

When I tried to send a diagnostic report, Kiwix popped up a toast asking me to "Please install an email client". I have an email client installed and opening mailto: links in other apps works fine.

@MohitMaliFtechiz
Copy link
Collaborator

Kiwix can open .zim files from my internal storage and from external USB media, regardless of their file path (as long as it is a child of /storage/emulated/0 and not /data),

@vincent-sparks Thanks for your feedback. Good to hear that it is opening the ZIM file from your USB stick.

but if I try to open a file from e.g. Termux's internal storage, Kiwix complains it cannot find it.

Ohh!! So you are using the termux storage, okay I am testing this with Termux storage and get back to you ASAP.

When I tried to send a diagnostic report, Kiwix popped up a toast asking me to "Please install an email client". I have an email client installed and opening mailto: links in other apps works fine.

Can you please tell me which email client/app do you have in your system?

@MohitMaliFtechiz
Copy link
Collaborator

@vincent-sparks I have made my research on this, and here are my points:

Termux uses the internal app-specific directory for storing the inside the /data folder which is inaccessible for other apps. You can verify the behavior by going inside the File Manager the /data is inaccessible to default Files(In Google Pixel devices). See here termux creates its directory inside the Android/data folder.

We can access the files from the termux directory via Storage Access Framework as mentioned in here that's why it is showing when you are picking the file via the "+" icon as it usages the SAF(Storage access framework) which give us the Uri to work with that file not the file path due to limitation of Android framework.

Currently, we can't open the ZIM files via uri since we need the proper file path to open the ZIM file, and for this, we are receiving the file path from the selected file's URI but due to it being internal to the Termux app directory android does not allow to getting the path, means we can only work with the provided URI by SAF. Currently, we can't open the file from URI, and we have a ticket for this to open the ZIM files via fd openzim/libzim#852. After implementing this, this issue will be fixed.

So at the moment, my suggestion is to put the ZIM files in device storage instead of termux storage.

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

Successfully merging a pull request may close this issue.

3 participants