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

Fixed: application was crashing when starting the kiwix server. #3846

Merged
merged 3 commits into from
May 17, 2024

Conversation

MohitMaliFtechiz
Copy link
Collaborator

@MohitMaliFtechiz MohitMaliFtechiz commented May 15, 2024

Fixes #3845

  • Added a check for checking the MANAGE_EXTERNAL_STORAGE permission when starting the server in the non-playStore variant. If there is no permission, then it asks for permission to avoid the crash due to permission lack for file.
  • Improved the permission asking when the user tries to start the server in all variants and all versions of Android so that it will ask storage(read/write) permission for below Android 13 in non-playStore variant. Also, ask for the MANAGE_EXTERNAL_STORAGE permission in Android 11 and above. This check ensures that without the storage and MANAGE_EXTERNAL_PERMISSION user can not start the server. Because if the application does not have storage permission then it crashes when creating the Archive object.
  • Fixed: application crashing when hosting the split zim files on the server, since we have an issue with split zim files of zim-tools Zim-tools version 3.3.0 splitted zim files giving Corrupted block detected error when there is a 0 size extra ZIM chunk. #3827. Due to this issue, there is a crash reported on the playStore. Because we have full access to files in the playStore variant since all the files are located in the app-specific directory.
Crash scenario After Fix
IssueeWithSplitZimFiles.mp4
FixServerIssueWithSplitZimFiles.mp4
  • Improved the log for showing the actual error if there is something goes wrong while adding the book in Library.

@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as draft May 15, 2024 10:18
@MohitMaliFtechiz MohitMaliFtechiz changed the title Fixed: A crash occurred when starting the kiwix server. Fixed: application was crashing when starting the kiwix server. May 15, 2024
Copy link

codecov bot commented May 15, 2024

Codecov Report

Attention: Patch coverage is 6.52174% with 43 lines in your changes are missing coverage. Please review.

Project coverage is 53.79%. Comparing base (a155b62) to head (e48e46b).

Files Patch % Lines
...iwix/kiwixmobile/core/webserver/ZimHostFragment.kt 7.14% 39 Missing ⚠️
...rg/kiwix/kiwixmobile/core/webserver/KiwixServer.kt 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3846      +/-   ##
============================================
- Coverage     54.00%   53.79%   -0.22%     
+ Complexity     1328     1327       -1     
============================================
  Files           292      292              
  Lines         11079    11119      +40     
  Branches       1471     1480       +9     
============================================
- Hits           5983     5981       -2     
- Misses         4112     4152      +40     
- Partials        984      986       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

* Added a check for checking the `MANAGE_EXTERNAL_STORAGE` permission when starting the server in the non-playStore variant. If there is no permission, then it ask for the permission to avoid the crash due to permission lack for file.
…r in all variants and all versions of Android so that it will ask storage(read/write) permission for below Android 13 in non-playStore variant. Also, ask for the `MANAGE_EXTERNAL_STORAGE` permission in Android 11 and above. This check ensures that without the storage and `MANAGE_EXTERNAL_PERMISSION` user can not start the server.
…r, since we have an issue with split zim files of `zim-tools`. Due to this issue, there is crash reported on the playStore. Because we have full access to files in the playStore variant since all the files are located in the `app-specific` directory.

* Improved the log for showing the actual error if there is something goes wrong while adding the book in `Library`.
@kelson42
Copy link
Collaborator

@MohitMaliFtechiz So we agree that this bug appears only if we have an empty chunk ofmzim file?

@MohitMaliFtechiz
Copy link
Collaborator Author

@MohitMaliFtechiz So we agree that this bug appears only if we have an empty chunk ofmzim file?

@kelson42 Yes, in the PS version this bug only happens if there is an empty chunk. For the non-PS version, there is this type of error because of a lack of permission(if the user intentionally disabled the permission) so here in this PR, we are fixing both issues.

@kelson42 kelson42 closed this May 17, 2024
@kelson42 kelson42 reopened this May 17, 2024
@kelson42 kelson42 merged commit e4924d8 into main May 17, 2024
16 of 17 checks passed
@kelson42 kelson42 deleted the Fix#3845 branch May 17, 2024 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A crash occurred when starting the kiwix server.
3 participants