refactor(coverart): one image Content-Type table for /api and Subsonic (#8002)

api/media.go and subsonic/stream.go each had imageContentType, the
same map in a different order, serving the same files.
coverart.ImageContentType is now the one copy, with its test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 12:45:50 -05:00
co-authored by Claude Opus 5.5
parent 074d9ffb0e
commit 55a290cf4d
6 changed files with 47 additions and 67 deletions
-16
View File
@@ -37,19 +37,3 @@ func TestFindSidecarCover(t *testing.T) {
t.Errorf("cover.jpg priority = %q, want %q", got, cover)
}
}
func TestImageContentType(t *testing.T) {
cases := map[string]string{
"cover.jpg": "image/jpeg",
"cover.JPEG": "image/jpeg",
"art.png": "image/png",
"thumb.gif": "image/gif",
"square.webp": "image/webp",
"unknown.tiff": "application/octet-stream",
}
for in, want := range cases {
if got := imageContentType(in); got != want {
t.Errorf("imageContentType(%q) = %q, want %q", in, got, want)
}
}
}