-
-
Notifications
You must be signed in to change notification settings - Fork 472
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
Fixed: Kiwix cannot import ZIM files from the filesystem. #4218
base: main
Are you sure you want to change the base?
Conversation
* Displaying a proper error message with the full ZIM path when there is an issue opening the ZIM file or if the selected file is not a valid ZIM file. * Refactored `CopyMoveFileHandlerTest` to align with this change. * Updated the documentation to help translators understand this update. * To resolve the lint error, all string files have been updated. These files will be automatically updated in the latest TranslateWiki PR.
Codecov ReportAttention: Patch coverage is
❌ Your patch check has failed because the patch coverage (28.20%) is below the target coverage (70.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #4218 +/- ##
============================================
+ Coverage 57.18% 57.35% +0.17%
- Complexity 1584 1587 +3
============================================
Files 316 316
Lines 13746 13765 +19
Branches 1722 1725 +3
============================================
+ Hits 7860 7895 +35
+ Misses 4692 4663 -29
- Partials 1194 1207 +13 ☔ View full report in Codecov by Sentry. |
…d Above. * The getExternalFilesDirs method only returns the USB path for devices running Android 9 (API 28) and below. * On Android 10 (API 29) and above, this method returns null when accessing external storage like USB sticks. * To work around this limitation, we previously appended the /mnt/media_rw/ path manually. While this worked in most cases, it was unreliable across different devices, as the mounted path could vary. * To ensure accurate retrieval of external storage paths, we have switched to the StorageService API. * This API, introduced in Android 11 (API 30), directly provides the actual mount paths for all external storage devices, including SD cards, USB sticks, and external hard drives. * For Android 9 and below, getExternalFilesDirs continues to work as expected, so we use it where applicable. * This improvement ensures that USB and SD card paths are retrieved correctly on modern Android devices. * Added debugging logs to capture errors when opening a file in the reader. * These logs will help us diagnose issues when users share a diagnostic report.
Fixes #4216
getExternalFilesDirs
correctly returns USB paths. However, on Android 10 (API 29) and above, it returns null for external storage like USB sticks. Previously, we appended/mnt/media_rw/
as a workaround which works in most of the devices, but this was unreliable due to varying mount paths across devices.StorageService
API, which accurately retrieves mount paths for SD cards, USB sticks, and external hard drives See. We now use this API on Android 10+ while keepinggetExternalFilesDirs
for Android 9 and below since it is correctly working on those devices. This ensures reliable USB and SD card path detection on modern devices. Additionally, we've added debugging logs to capture errors when opening files in the reader.CopyMoveFileHandlerTest
to align with this change.