GetCoverArt returns placeholder if id is missing
This mimics Subsonic behaviour, even if it contradicts the API documentation, which states `id` is required Fixes #1139
This commit is contained in:
@@ -58,10 +58,7 @@ func (c *MediaRetrievalController) getPlaceHolderAvatar(w http.ResponseWriter, r
|
||||
}
|
||||
|
||||
func (c *MediaRetrievalController) GetCoverArt(w http.ResponseWriter, r *http.Request) (*responses.Subsonic, error) {
|
||||
id, err := requiredParamString(r, "id")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
id := utils.ParamStringDefault(r, "id", "non-existent")
|
||||
size := utils.ParamInt(r, "size", 0)
|
||||
|
||||
w.Header().Set("cache-control", "public, max-age=315360000")
|
||||
|
||||
@@ -37,11 +37,12 @@ var _ = Describe("MediaRetrievalController", func() {
|
||||
Expect(w.Body.String()).To(Equal(artwork.data))
|
||||
})
|
||||
|
||||
It("should fail if missing id parameter", func() {
|
||||
It("should return placeholder if id parameter is missing (mimicking Subsonic)", func() {
|
||||
r := newGetRequest()
|
||||
_, err := controller.GetCoverArt(w, r)
|
||||
|
||||
Expect(err).To(MatchError("required 'id' parameter is missing"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(w.Body.String()).To(Equal(artwork.data))
|
||||
})
|
||||
|
||||
It("should fail when the file is not found", func() {
|
||||
|
||||
Reference in New Issue
Block a user