Add support for AVIF, JPEG XL, and HEIF image formats across the stack. Currently these formats fail at three points in the rendering pipeline:
- Knot server returns 403:
http.DetectContentType()in Go doesn't recognize AVIF/JXL/HEIF, returningapplication/octet-stream, which hits thedefaultcase and returns HTTP 403. - Camo proxy returns 415:
image/avif,image/jxl, andimage/heifare missing from the allowed MIME types list inmimetypes.json. - Blob viewer doesn't render as image:
.avif,.jxl,.heic,.heifare missing from the image extension switch inNewBlobView.
Changes#
knotserver/xrpc/repo_blob.go: Replace the singleiffor.svgwith aswitchthat also overrides MIME types for.avif,.jxl,.heic,.heifcamo/src/mimetypes.json: Addimage/avif,image/heif,image/jxlto the allowed MIME types listappview/repo/blob.go: Add.avif,.jxl,.heic,.heifto the image extension case in the blob viewer
Reproduction#
Any repo with .avif images in its README, e.g. https://tangled.org/@overby.me/overby-me
AVIF has 97%+ browser support and is increasingly common as a modern replacement for JPEG/PNG/WebP.