diff --git a/appview/repo/blob.go b/appview/repo/blob.go --- a/appview/repo/blob.go +++ b/appview/repo/blob.go @@ -236,7 +236,7 @@ ext := strings.ToLower(filepath.Ext(resp.Path)) switch ext { - case ".jpg", ".jpeg", ".png", ".gif", ".webp": + case ".jpg", ".jpeg", ".png", ".gif", ".webp", ".avif", ".jxl", ".heic", ".heif": view.ContentType = models.BlobContentTypeImage view.HasRawView = true view.HasRenderedView = true diff --git a/camo/src/mimetypes.json b/camo/src/mimetypes.json --- a/camo/src/mimetypes.json +++ b/camo/src/mimetypes.json @@ -1,10 +1,13 @@ [ + "image/avif", "image/bmp", "image/cgm", "image/g3fax", "image/gif", + "image/heif", "image/ief", "image/jp2", + "image/jxl", "image/jpeg", "image/jpg", "image/pict", diff --git a/knotserver/xrpc/repo_blob.go b/knotserver/xrpc/repo_blob.go --- a/knotserver/xrpc/repo_blob.go +++ b/knotserver/xrpc/repo_blob.go @@ -74,8 +74,16 @@ mimeType := http.DetectContentType(contents) - if filepath.Ext(treePath) == ".svg" { + // override MIME types for formats that http.DetectContentType does not recognize + switch filepath.Ext(treePath) { + case ".svg": mimeType = "image/svg+xml" + case ".avif": + mimeType = "image/avif" + case ".jxl": + mimeType = "image/jxl" + case ".heic", ".heif": + mimeType = "image/heif" } if raw {