Skip to content

fix: skip whitespace-only segments in parse_mimetype#13024

Draft
muhamedfazalps wants to merge 5 commits into
aio-libs:masterfrom
muhamedfazalps:fix/parse-mimetype-whitespace
Draft

fix: skip whitespace-only segments in parse_mimetype#13024
muhamedfazalps wants to merge 5 commits into
aio-libs:masterfrom
muhamedfazalps:fix/parse-mimetype-whitespace

Conversation

@muhamedfazalps

@muhamedfazalps muhamedfazalps commented Jul 1, 2026

Copy link
Copy Markdown

What is the change

Fixed to skip whitespace-only segments after semicolons, preventing spurious empty-key parameters.

Why is the change needed

produces instead of , polluting parameter dicts.

Checklist

  • I have read the contributor guidelines
  • Tests added/updated
  • Changelog entry added

Drafted with Claude Code; reviewed by muhamedfazalps.

parse_mimetype: change 'if not item' to 'if not item.strip()' to
skip whitespace-only segments after semicolons, preventing spurious
empty-key parameters.

DeflateBuffer.feed_data: add early return on empty chunks to prevent
IndexError when sniffing the CM byte of the zlib header.

Fixes aio-libs#13009
Fixes aio-libs#12994
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.84%. Comparing base (f24eced) to head (4c29d65).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #13024      +/-   ##
==========================================
- Coverage   98.96%   98.84%   -0.13%     
==========================================
  Files         131      129       -2     
  Lines       48156    48112      -44     
  Branches     2499     2489      -10     
==========================================
- Hits        47656    47554     -102     
- Misses        376      430      +54     
- Partials      124      128       +4     
Flag Coverage Δ
Autobahn ?
CI-GHA 98.88% <100.00%> (-0.03%) ⬇️
OS-Linux 98.63% <100.00%> (-0.05%) ⬇️
OS-Windows 97.04% <100.00%> (ø)
OS-macOS 97.85% <100.00%> (-0.11%) ⬇️
Py-3.10 97.51% <100.00%> (-0.63%) ⬇️
Py-3.11 96.57% <100.00%> (-1.84%) ⬇️
Py-3.12 98.50% <100.00%> (+<0.01%) ⬆️
Py-3.13 97.77% <100.00%> (-0.71%) ⬇️
Py-3.14 98.47% <100.00%> (-0.03%) ⬇️
Py-3.14t ?
Py-pypy-3.11 ?
VM-macos 97.85% <100.00%> (-0.11%) ⬇️
VM-ubuntu 98.63% <100.00%> (-0.05%) ⬇️
VM-windows 97.04% <100.00%> (ø)
cython-coverage 38.11% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Change 'if not item' to 'if not item.strip()' to skip whitespace-only
segments after semicolons, preventing spurious empty-key parameters.

Fixes aio-libs#13009
@muhamedfazalps muhamedfazalps changed the title fix: handle empty chunks in parse_mimetype and DeflateBuffer fix: skip whitespace-only segments in parse_mimetype Jul 1, 2026
@codspeed-hq

codspeed-hq Bot commented Jul 1, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 83 untouched benchmarks
⏩ 83 skipped benchmarks1


Comparing muhamedfazalps:fix/parse-mimetype-whitespace (4c29d65) with master (f24eced)

Open in CodSpeed

Footnotes

  1. 83 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

After semicolons, whitespace-only segments produce spurious
empty-key parameters. Use .strip() to skip them.

Fixes aio-libs#13009
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.

1 participant