docs(api): document intentional audioContentType divergence from subsonic

This commit is contained in:
2026-04-21 22:35:29 -04:00
parent c799e5c1c9
commit 5af6d7fac6
2 changed files with 7 additions and 0 deletions
+1
View File
@@ -107,6 +107,7 @@ func seedTrackWithFile(t *testing.T, pool *pgxpool.Pool, albumID, artistID pgtyp
ArtistID: artistID,
TrackNumber: &one,
DiscNumber: nil,
// DurationMs: arbitrary non-zero; tests don't assert on it.
DurationMs: int32(len(fileBody)),
FilePath: path,
FileSize: int64(len(fileBody)),
+6
View File
@@ -57,6 +57,12 @@ func resolveAlbumCoverPath(ctx context.Context, q *dbq.Queries, album dbq.Album)
// ogg, opus, m4a, aac, wav) to a MIME type for the Content-Type header.
// Unknown formats fall back to octet-stream so the browser downloads them
// rather than attempting to decode.
//
// Divergences from internal/subsonic/types.go's contentTypeForFormat are
// intentional: opus→audio/ogg (library .opus files are Ogg-encapsulated, so
// this matches real library contents), aac→audio/aac (raw AAC is ADTS, not
// MP4, so audio/mp4 would mislead codec sniffers), and there is no "oga" case
// (we don't record that format). Don't "fix" these to match subsonic.
func audioContentType(format string) string {
switch strings.ToLower(format) {
case "mp3":