fix: helper function to strip mime params#1050
fix: helper function to strip mime params#1050Pranavjeet-Naidu wants to merge 2 commits intoopenzim:mainfrom
Conversation
Signed-off-by: Pranavjeet-Naidu <pranavjeetnaidu@gmail.com>
2200ab0 to
b9ee28c
Compare
|
@kelson42 is the RTD fail because of the rebase or something else that I have to fix? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1050 +/- ##
==========================================
- Coverage 56.26% 56.23% -0.03%
==========================================
Files 101 101
Lines 5014 5027 +13
Branches 2186 2194 +8
==========================================
+ Hits 2821 2827 +6
- Misses 737 738 +1
- Partials 1456 1462 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a small internal helper to normalize MIME types by removing parameters (everything after ;), and uses it when generating the writer “Counter” metadata so downstream tooling (zim-tools) can reliably validate/count articles by base MIME type.
Changes:
- Add
zim::stripMimeParameters()to strip MIME parameters and trim whitespace before the first;. - Apply MIME-parameter stripping in
CounterHandlerbefore incrementing the MIME counter. - Add unit tests covering common and edge-case MIME strings for the new helper.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
test/tooltesting.cpp |
Adds tests for stripMimeParameters() behavior across typical and edge inputs. |
src/tools.h |
Declares the new private helper API. |
src/tools.cpp |
Implements stripMimeParameters(). |
src/writer/counterHandler.h |
Adds <string> include for the std::string counter key type. |
src/writer/counterHandler.cpp |
Normalizes MIME types (strip params) before counting, preventing parameter variants from inflating counts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Pranavjeet-Naidu <pranavjeetnaidu@gmail.com>
|
@kelson42 the RTD fail is fixed, and about the codecov fail, ill need to add an integration test for the uncovered lines: It'll probably be added in src/writer/creator.cpp, but doesn't seem necessary and the partials also seem unnecessary, please confirm. If no more changes are needed, I'll squash again. |
|
@Pranavjeet-Naidu Thank younfor your PR, but I guess you have linked the wrong issue in your PR description!? |
Actually nope. I linked this issue because of your reply in the end over there. You concluded saying we have to strip MIME type paras. Please let me know if there's a better issue to link instead. |
handles #1000
Basically a helper function that strips MIME-types params.
should fix the article count issue with the regex validation in zim-tools, this in libzim.