refactor: extract magic byte detection into internal/magic package #42

Open
clawbot wants to merge 1 commits from refactor/extract-magic-package into main

1 Commits

Author SHA1 Message Date
user
dedc729f37 refactor: extract magic byte detection into internal/magic package
All checks were successful
check / check (push) Successful in 52s
Move MIMEType, DetectFormat, ValidateMagicBytes, PeekAndValidate,
IsSupportedMIMEType, MIMEToImageFormat, and ImageFormatToMIME from
internal/imgcache into a new internal/magic package.

The magic package defines its own ImageFormat type and constants to
avoid circular imports (imgcache imports magic for validation,
magic cannot import imgcache).

Update import sites in imgcache/service.go and service_test.go.

Part of issue #39.
2026-03-25 17:46:40 -07:00