🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
fix(subsonic): always include mandatory title field in Child responses
Deluana887521d7a27
diff --git a/server/subsonic/helpers_test.go b/server/subsonic/helpers_test.goindex d20ca89ad..4eb756b98 100644--- a/server/subsonic/helpers_test.go+++ b/server/subsonic/helpers_test.go@@ -309,6 +309,14 @@ var _ = Describe("helpers", func() {Expect(child.Artist).To(Equal("Test Artist"))})})++ Context("when MediaFile has an empty title", func() {+ It("still includes the title field in the response", func() {+ mf.Title = ""+ child := childFromMediaFile(ctx, mf)+ Expect(child.Title).To(Equal(""))+ })+ })})Describe("osChildFromMediaFile", func() {diff --git a/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .JSON b/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .JSONindex a50603bf9..8491a577b 100644--- a/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .JSON+++ b/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .JSON@@ -9,6 +9,7 @@{"id": "1","isDir": false,+ "title": "","bpm": 0,"comment": "","sortName": "sort name",diff --git a/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .XML b/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .XMLindex 45b7033f3..5d9e83f96 100644--- a/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .XML+++ b/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .XML@@ -1,6 +1,6 @@<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.16.1" type="navidrome" serverVersion="v0.55.0" openSubsonic="true"><albumList>- <album id="1" isDir="false" sortName="sort name" mediaType="album" musicBrainzId="00000000-0000-0000-0000-000000000000" displayArtist="Display artist" displayAlbumArtist="Display album artist" explicitStatus="explicit">+ <album id="1" isDir="false" title="" sortName="sort name" mediaType="album" musicBrainzId="00000000-0000-0000-0000-000000000000" displayArtist="Display artist" displayAlbumArtist="Display album artist" explicitStatus="explicit"><genres name="Genre 1"></genres><genres name="Genre 2"></genres><moods>mood1</moods>diff --git a/server/subsonic/responses/.snapshots/Responses Child with data should match .JSON b/server/subsonic/responses/.snapshots/Responses Child with data should match .JSONindex 448a84d6a..d20a6d48c 100644--- a/server/subsonic/responses/.snapshots/Responses Child with data should match .JSON+++ b/server/subsonic/responses/.snapshots/Responses Child with data should match .JSON@@ -115,6 +115,7 @@{"id": "","isDir": false,+ "title": "","bpm": 0,"comment": "","sortName": "",diff --git a/server/subsonic/responses/.snapshots/Responses Child with data should match .XML b/server/subsonic/responses/.snapshots/Responses Child with data should match .XMLindex 2de1efbfb..1d307b0b9 100644--- a/server/subsonic/responses/.snapshots/Responses Child with data should match .XML+++ b/server/subsonic/responses/.snapshots/Responses Child with data should match .XML@@ -25,7 +25,7 @@<artist id="4" name="composer2"></artist></contributors></child>- <child id="" isDir="false">+ <child id="" isDir="false" title=""><replayGain trackGain="0" albumGain="0" trackPeak="0" albumPeak="0" baseGain="0" fallbackGain="0"></replayGain></child></directory>diff --git a/server/subsonic/responses/.snapshots/Responses Child without data should match .JSON b/server/subsonic/responses/.snapshots/Responses Child without data should match .JSONindex 2d0995831..b66a2bdea 100644--- a/server/subsonic/responses/.snapshots/Responses Child without data should match .JSON+++ b/server/subsonic/responses/.snapshots/Responses Child without data should match .JSON@@ -8,7 +8,8 @@"child": [{"id": "1",- "isDir": false+ "isDir": false,+ "title": ""}],"id": "",diff --git a/server/subsonic/responses/.snapshots/Responses Child without data should match .XML b/server/subsonic/responses/.snapshots/Responses Child without data should match .XMLindex 3e5a1cf13..d64d526d6 100644--- a/server/subsonic/responses/.snapshots/Responses Child without data should match .XML+++ b/server/subsonic/responses/.snapshots/Responses Child without data should match .XML@@ -1,5 +1,5 @@<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.16.1" type="navidrome" serverVersion="v0.55.0" openSubsonic="true"><directory id="" name="">- <child id="1" isDir="false"></child>+ <child id="1" isDir="false" title=""></child></directory></subsonic-response>diff --git a/server/subsonic/responses/.snapshots/Responses Child without data should match OpenSubsonic .JSON b/server/subsonic/responses/.snapshots/Responses Child without data should match OpenSubsonic .JSONindex c3ccc6cd0..25284295e 100644--- a/server/subsonic/responses/.snapshots/Responses Child without data should match OpenSubsonic .JSON+++ b/server/subsonic/responses/.snapshots/Responses Child without data should match OpenSubsonic .JSON@@ -9,6 +9,7 @@{"id": "1","isDir": false,+ "title": "","bpm": 0,"comment": "","sortName": "",diff --git a/server/subsonic/responses/.snapshots/Responses Child without data should match OpenSubsonic .XML b/server/subsonic/responses/.snapshots/Responses Child without data should match OpenSubsonic .XMLindex 3e5a1cf13..d64d526d6 100644--- a/server/subsonic/responses/.snapshots/Responses Child without data should match OpenSubsonic .XML+++ b/server/subsonic/responses/.snapshots/Responses Child without data should match OpenSubsonic .XML@@ -1,5 +1,5 @@<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.16.1" type="navidrome" serverVersion="v0.55.0" openSubsonic="true"><directory id="" name="">- <child id="1" isDir="false"></child>+ <child id="1" isDir="false" title=""></child></directory></subsonic-response>diff --git a/server/subsonic/responses/responses.go b/server/subsonic/responses/responses.goindex c550ce61e..b70f3b128 100644--- a/server/subsonic/responses/responses.go+++ b/server/subsonic/responses/responses.go@@ -135,7 +135,7 @@ type Child struct {Id string `xml:"id,attr" json:"id"`Parent string `xml:"parent,attr,omitempty" json:"parent,omitempty"`IsDir bool `xml:"isDir,attr" json:"isDir"`- Title string `xml:"title,attr,omitempty" json:"title,omitempty"`+ Title string `xml:"title,attr" json:"title"`Name string `xml:"name,attr,omitempty" json:"name,omitempty"`Album string `xml:"album,attr,omitempty" json:"album,omitempty"`Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`