Skip to content

Normalize image MIME before runtime presentation evidence binding - #829

Merged
chubes4 merged 1 commit into
Automattic:mainfrom
faisalahammad:fix/821-image-mime-runtime-evidence
Aug 3, 2026
Merged

Normalize image MIME before runtime presentation evidence binding#829
chubes4 merged 1 commit into
Automattic:mainfrom
faisalahammad:fix/821-image-mime-runtime-evidence

Conversation

@faisalahammad

@faisalahammad faisalahammad commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Fixes #821.

Summary

  • Classify runtime presentation evidence assets by path extension via the existing isImagePath() instead of MIME prefix (/^image\//), so images with a generic MIME declaration (e.g. .gif typed as application/octet-stream) are still bound into the browser asset hash map.
  • Add .gifimage/gif and .avifimage/avif to fileType() and add .avif to isImagePath(), matching the extension map used downstream by blocks-engine's ArtifactNormalizer.
  • Add coverage for generic-MIME .gif/.avif inclusion and unrelated-binary exclusion in tools/fixture-matrix.test.mjs.

Test Plan

  • npm run test:fixture-matrix — 249/249 pass.
  • npm test — 45/45 on changed scope. One remaining failure (smoke-url-batch-import.php) also fails on clean main and is unrelated.

The runtime presentation evidence probe filtered artifact files by MIME
prefix (/^image\//), but fileType() falls back to application/octet-stream
for extensions it does not map (gif, avif). A .gif typed as octet-stream
was silently excluded from the browser asset hash map, so no bound
observation was emitted for that image.

Classify by extension instead, reusing isImagePath(), which already
includes gif and now covers avif to match the downstream Blocks Engine
normalizer's extension map. fileType() also gains gif/avif mappings for
consistency. The probe now binds generic-MIME image files while still
excluding unrelated binaries.

Refs Automattic#821.
@faisalahammad
faisalahammad force-pushed the fix/821-image-mime-runtime-evidence branch from 5fe0c4c to 3743aea Compare August 3, 2026 20:13
@chubes4
chubes4 merged commit 7f943da into Automattic:main Aug 3, 2026
6 checks passed
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.

Normalize image MIME before runtime presentation evidence binding

2 participants