🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
fix(playlists): make the m3u parser case-insensitive again #3410
Caio Cotts82633d7490df
diff --git a/core/playlists.go b/core/playlists.goindex bc870bd24..5bb3f57af 100644--- a/core/playlists.go+++ b/core/playlists.go@@ -162,10 +162,10 @@ func (s *playlists) parseM3U(ctx context.Context, pls *model.Playlist, baseDir s}existing := make(map[string]int, len(found))for idx := range found {- existing[found[idx].Path] = idx+ existing[strings.ToLower(found[idx].Path)] = idx}for _, path := range filteredLines {- idx, ok := existing[path]+ idx, ok := existing[strings.ToLower(path)]if ok {mfs = append(mfs, found[idx])} else {diff --git a/core/playlists_test.go b/core/playlists_test.goindex ca1ddbfe6..e31dc4610 100644--- a/core/playlists_test.go+++ b/core/playlists_test.go@@ -142,6 +142,20 @@ var _ = Describe("Playlists", func() {Expect(pls.Tracks[1].Path).To(Equal("test1.mp3"))Expect(pls.Tracks[2].Path).To(Equal("test2.mp3"))})++ It("is case-insensitive when comparing paths", func() {+ repo.data = []string{+ "tEsT1.Mp3",+ }+ m3u := strings.Join([]string{+ "TeSt1.mP3",+ }, "\n")+ f := strings.NewReader(m3u)+ pls, err := ps.ImportM3U(ctx, f)+ Expect(err).ToNot(HaveOccurred())+ Expect(pls.Tracks).To(HaveLen(1))+ Expect(pls.Tracks[0].Path).To(Equal("tEsT1.Mp3"))+ })})})