Not able to open a ZIM file from file explorer
On on my Android14 Samsung tablet
Hey Kelson, Can I work on this issue...
@jangalasriramd7 Thank you for your offer, but I have already assigned the issue to @MohitMaliFtechiz and would prefer to keep it like that. Maybe you can pick up one of the goodfirstissues?
@kelson42 The problem is with the Samsung file manager application. The Samsung file manager passes the empty mimeType when we click on the zim file in the file manager of Samsung. That's why our application does not recognize that intent. Also, we have implemented the approach where we have added the pathPattern for zim files, but that also does not work in the case of Samsung file manager since it is giving the intent data in this form File path: /external/file/2826 which does not have the .zim in it.
I have installed a fileManager in this Samsung mobile and tried to click on the zim file there and it works.
A proper explanation is given here https://forum.developer.samsung.com/t/opening-files-with-unknown-content-type-from-my-files/30335 about this problem.
https://github.com/user-attachments/assets/138bc957-61cf-490e-8dac-0eb064eb9569
@MohitMaliFtechiz Opening ZIM file has to work with most common file manager. Samsung is probably the biggest Android reseller, it has to work on there device. Can you please update the CI accordingly?
@MohitMaliFtechiz Opening ZIM file has to work with most common file manager. Samsung is probably the biggest Android reseller, it has to work on there device. Can you please update the CI accordingly?
@kelson42 you are right it should work, but it can not work due to Samsung's "My Files" implementation. They do not recognize the application/octet-stream as standard mimeType of Android and return the empty mimeType for our ZIM files, and due to the empty mimeType, our application does not recognize it. Keyman(https://github.com/keymanapp/keyman/issues/10133) is also facing the same issue for their files with Samsung "My Files" since their files mimeType is the same(application/octet-stream). Samsung acknowledged the issue in their app, but they refused to fix it.
A temporary fix I was trying to create a custom intent filter for Samsung "My Files" It works but it shows our application in the suggestion list for all the files(e.g. image video, pdf, etc) which is not good.
Which software that says the ZIM file mimetype is application/octet-stream or does that come from the OS? We should have a custom/dedicated mimetype?
@kelson42 The mimeType is coming from the OS, and if I view the details of the ZIM file on my PC then it also shows the same mimeType for the ZIM file. Regarding the custom mimeType: Samsung's file explorer returns the mimeTypes for standard files, e.g. images, videos, pdf, etc. I have to do some research first that it returns the mimeType or not for the dedicated mimeType, otherwise, we have to enable all mimeTypes for the "my files" file explorer like I done in https://github.com/kiwix/kiwix-android/pull/4022.
@MohitMaliFtechiz If it's not possible to get proper ZIM mimetype, then we have to allow Kiwix to open any file.... Which implies a proper error mgmt, in case the file is not a ZIM file.