Skip to content

Match all registered types sharing a MIME value - #166

Open
omrzk wants to merge 1 commit into
h2non:masterfrom
omrzk:fix/mime-shared-types
Open

omrzk wants to merge 1 commit into
h2non:masterfrom
omrzk:fix/mime-shared-types

Conversation

@omrzk

@omrzk omrzk commented Oct 29, 2026

Copy link
Copy Markdown

IsMIME stops at the first registered type with the requested MIME value, even when that type does not match the bytes. WOFF/WOFF2 and TTF/OTF share MIME values, so valid font headers can return false depending on registry iteration order.

Continue checking types with the same MIME value until a matcher succeeds. Regression cases cover all four built-in font types and invalid input; the original implementation fails the WOFF2/TTF cases.

Validation: full Go 1.26.10 race suite and Go 1.16.15 suite pass; formatting and diff checks pass. Go 1.26 go vet ./... reports the existing Types sync.Map copy at filetype.go:11, identically on clean master and this branch. These are local header fixtures; no font rendering or deployment test is claimed.

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