Skip to content

Commit 34f1f5f

Browse files
fix: 🐛 search endpoint was returning incorrect format when searching inside navidrome
1 parent 3e14a2d commit 34f1f5f

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

src/service/search.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,13 @@ func NewSearchService(rp *SubsonicReverseProxy, metadata metadata.Provider) *Sea
2121
}
2222

2323
func (s *SearchService) SmartSearch(ctx context.Context, query string, path string, rawQuery string) ([]byte, string, error) {
24-
body, contentType, err := s.rp.SearchNavidrome(ctx, path, rawQuery)
25-
if err == nil && body != nil {
26-
bytes, err := json.Marshal(body)
27-
if err != nil {
28-
return nil, "", err
29-
}
30-
return bytes, contentType, nil
31-
}
24+
subsonicSongs, _, err := s.rp.SearchNavidrome(ctx, path, rawQuery)
3225

33-
if len(body) > 0 {
34-
jsonBody, err := json.Marshal(body)
26+
if len(subsonicSongs) > 0 {
27+
jsonBody, err := json.Marshal(WrapExternalSearch(subsonicSongs))
3528
if err != nil {
3629
return nil, "", err
3730
}
38-
3931
return jsonBody, "application/json; charset=utf-8", nil
4032
}
4133

0 commit comments

Comments
 (0)