openzim / libzim

Reference implementation of the ZIM specification
https://download.openzim.org/release/libzim/
GNU General Public License v2.0
164 stars 50 forks source link

`getMediaCount` does not fail if `M/Counter` is missing. #827

Closed mgautierfr closed 10 months ago

mgautierfr commented 11 months ago

No reason to fail in getMediaCount if M/Counter is missing.

We test it by reading an empty zim file. This reveal a bug in getNamespaceBeginOffset when there is no dirent in the direntAccessor.

Fix kiwix/kiwix-tools#640

codecov[bot] commented 11 months ago

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (bd8f79c) 57.53% compared to head (167be70) 57.57%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #827 +/- ## ========================================== + Coverage 57.53% 57.57% +0.04% ========================================== Files 98 98 Lines 4540 4545 +5 Branches 1907 1911 +4 ========================================== + Hits 2612 2617 +5 + Misses 674 668 -6 - Partials 1254 1260 +6 ``` | [Files](https://app.codecov.io/gh/openzim/libzim/pull/827?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openzim) | Coverage Δ | | |---|---|---| | [src/dirent\_lookup.h](https://app.codecov.io/gh/openzim/libzim/pull/827?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openzim#diff-c3JjL2RpcmVudF9sb29rdXAuaA==) | `58.75% <0.00%> (+1.05%)` | :arrow_up: | | [src/archive.cpp](https://app.codecov.io/gh/openzim/libzim/pull/827?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openzim#diff-c3JjL2FyY2hpdmUuY3Bw) | `48.76% <40.00%> (+0.22%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/openzim/libzim/pull/827/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=openzim)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.