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

Implemented error handling for cases when the selected file is not a ZIM file. #4046

Merged
merged 3 commits into from
Oct 31, 2024

Conversation

MohitMaliFtechiz
Copy link
Collaborator

@MohitMaliFtechiz MohitMaliFtechiz commented Oct 30, 2024

Parent Issue #4002

  • We retrieve the file name from the incoming Uri using DocumentFile (the official way to handle Uris) and check if it contains .zim or .zimma before proceeding with the copy/move operation. If the file name is null, we copy/move the file first and then validate it as a ZIM file using libkiwix. If valid, the file opens in our reader; otherwise, we revert the copy/move operation.
  • Added UI and unit test cases for this new functionality.
XRecorder_30102024_162120.mp4

@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as draft October 31, 2024 06:21
Copy link

codecov bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 25.92593% with 40 lines in your changes missing coverage. Please review.

Project coverage is 57.88%. Comparing base (ab3d8ff) to head (8f7ca9f).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...ile/nav/destination/library/CopyMoveFileHandler.kt 18.75% 37 Missing and 2 partials ⚠️
...le/nav/destination/library/LocalLibraryFragment.kt 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4046      +/-   ##
============================================
- Coverage     58.04%   57.88%   -0.16%     
- Complexity     1514     1515       +1     
============================================
  Files           315      315              
  Lines         13125    13161      +36     
  Branches       1671     1676       +5     
============================================
  Hits           7618     7618              
- Misses         4403     4441      +38     
+ Partials       1104     1102       -2     

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

@MohitMaliFtechiz MohitMaliFtechiz marked this pull request as ready for review October 31, 2024 10:27
…ZIM file.

* We retrieve the file name from the incoming Uri using `DocumentFile` (the official way to handle Uris) and check if it contains `.zim` or `.zimma` before proceeding with the copy/move operation. If the file name is null, we copy/move the file first and then validate it as a ZIM file using `libkiwix`. If valid, the file opens in our reader; otherwise, we revert the copy/move operation.
* Added test cases for this new functionality.
* Improved the unit test cases for this functionality.
@kelson42 kelson42 force-pushed the handle_copy_move_for_invalid_zim branch from 73b587e to 8f7ca9f Compare October 31, 2024 10:59
@kelson42 kelson42 merged commit a826ca1 into main Oct 31, 2024
21 of 22 checks passed
@kelson42 kelson42 deleted the handle_copy_move_for_invalid_zim branch October 31, 2024 12:51
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.

3 participants