fix(media-core): normalize GIF content type detection#96435
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 24, 2026, 1:03 PM ET / 17:03 UTC. Summary Reproducibility: yes. from source inspection: current main compares Review metrics: 4 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Preserve the two-file media-core fix, drop the unrelated second commit, rebase on current main, and review the unrelated changes only as separate purpose-built PRs if maintainers want them. Do we have a high-confidence way to reproduce the issue? Yes, from source inspection: current main compares Is this the best way to solve the issue? No for the current head: the first commit is the right narrow fix, but the later unrelated cross-repo commit makes this branch the wrong merge vehicle until it is dropped or split. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4ae0a5d958a0. Label changesLabel changes:
Label justifications:
Evidence reviewedSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
55f9724 to
3524e1d
Compare
|
Merged via squash.
Thanks @lin-hongkuan! |
Merged via squash. Prepared head SHA: 82b1396 Co-authored-by: lin-hongkuan <[email protected]> Co-authored-by: vincentkoc <[email protected]> Reviewed-by: @vincentkoc
Merged via squash. Prepared head SHA: 82b1396 Co-authored-by: lin-hongkuan <[email protected]> Co-authored-by: vincentkoc <[email protected]> Reviewed-by: @vincentkoc
What Problem This Solves
isGifMedia()only lowercasedcontentTypebefore comparing it withimage/gif. Real MIME headers can include parameters and surrounding whitespace, so values such asimage/gif; charset=binaryorIMAGE/GIFwere not recognized as GIF media.Other MIME helpers in this module already normalize content types by trimming, lowercasing, and removing parameters.
Why This Change Was Made
The GIF detector now uses the existing
normalizeMimeType()helper instead of open-coding a narrower comparison. This keeps GIF detection aligned with the rest of media-core MIME handling while preserving the existing filename fallback.A focused regression test covers parameterized content types, whitespace/case normalization, non-GIF content types, and
.giffilename fallback.User Impact
GIF attachments with parameterized or padded
Content-Typemetadata are classified correctly instead of being treated as non-GIF media. Existing.giffilename detection still works.Evidence
Direct behavior probe:
Targeted test:
Formatting:
Whitespace:
AI-assisted
Prepared with Codex. I reviewed the change, understand the touched code path, and kept the PR focused on the bug described above.