mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-01 07:21:17 +00:00
The Fields param was read with StringOr, which keeps only one value, so a request sending it as repeated params (Fields=Genres&Fields=MediaSources) — as Finamp and Feishin do — lost all but the first. Field-gated data like MediaSources was then omitted for Audio items even though the client asked for it; the comma-separated form happened to work because ParseFields splits on commas. Real Jellyfin accepts both forms. ParseFields is now variadic and a parseFields helper reads every repeated value via req.Values.Strings, applied to the item list, single-item, and playlist endpoints.
27 lines
693 B
Go
27 lines
693 B
Go
package dto
|
|
|
|
import (
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
var _ = Describe("ParseFields", func() {
|
|
It("parses a single comma-separated value", func() {
|
|
f := ParseFields("Genres,MediaSources")
|
|
Expect(f.Has("Genres")).To(BeTrue())
|
|
Expect(f.Has("MediaSources")).To(BeTrue())
|
|
})
|
|
|
|
It("parses fields spread across repeated params", func() {
|
|
f := ParseFields("Genres", "MediaSources", "SortName")
|
|
Expect(f.Has("Genres")).To(BeTrue())
|
|
Expect(f.Has("MediaSources")).To(BeTrue())
|
|
Expect(f.Has("SortName")).To(BeTrue())
|
|
})
|
|
|
|
It("returns an empty set for no values", func() {
|
|
Expect(ParseFields()).To(BeEmpty())
|
|
Expect(ParseFields("")).To(BeEmpty())
|
|
})
|
|
})
|