navidrome / navidrome

🎧☁️ Modern Music Server and Streamer compatible with Subsonic/Airsonic
https://www.navidrome.org
GNU General Public License v3.0
11.24k stars 839 forks source link

[Bug]: opensubsonic api search2 json result with no data #2864

Closed copart closed 6 months ago

copart commented 6 months ago

I confirm that:

Version

0.51.0

Current Behavior

I am trying to do a search2 that returns an EMPTY response WHEN I choose json as the result type

I am using insomnia to test the api access, however, I am including curl here so that it is more portable

This works

curl --request POST \                                                                                                                                       ⇄
  --url 'https://myurl:443/rest/search2.view?=' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --header 'User-Agent: insomnia/8.4.1' \
  --cookie nd-player-7374657665=4d83963a-8936-4135-81d5-5779c4198f08 \
  --data u=steve \
  --data v=1.16.1 \
  --data c=insomnia \
  --data s=mys \
  --data t=beef \
  --data 'query=""' \
  --data artistCount=0 \
  --data artistOffset=0 \
  --data albumCount=0 \
  --data albumOffset=0 \
  --data songCount=1 \
  --data songOffset=6893

Here is the result

<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.16.1" type="navidrome" serverVersion="0.51.0-1.fc39 (source_archive)" openSubsonic="true"><searchResult2><song id="b74d502ea57f00ddc80d20e3929961b9" parent="ac3e81bc2db8f86795761955bebfb072" isDir="false" title="Out Of The Cradle" album="Vapor Trails" artist="Rush" track="13" year="2002" genre="Heavy Prog" coverArt="mf-b74d502ea57f00ddc80d20e3929961b9_65cef8a4" size="5389411" contentType="audio/mpeg" suffix="mp3" duration="329" bitRate="128" path="Rush/Vapor Trails/13 - Out Of The Cradle.mp3" playCount="1" discNumber="1" created="2024-02-01T15:23:53.734876519-05:00" albumId="ac3e81bc2db8f86795761955bebfb072" artistId="47982c18f4861b2edf96bfe9f73f12bf" type="music" isVideo="false" played="2021-07-16T08:16:59-04:00" bpm="156" comment="" sortName="" mediaType="song" musicBrainzId=""><genres name="Heavy Prog"></genres><replayGain trackGain="+Inf" albumGain="-11.23" albumPeak="1.283165"></replayGain></song></searchResult2></subsonic-response>

In the LogLevel with logFormat = debug

Feb 17 13:13:16 mydomain.local navidrome[654025]: time="2024-02-17T13:13:16-05:00" level=debug msg="API: New request /rest/search2.view" client=insomnia requestId=mydomain.local/0qAec3LZuY-002002 username=steve version=1.16.1
Feb 17 13:13:16 mydomain.local navidrome[654025]: time="2024-02-17T13:13:16-05:00" level=debug msg="Search resulted in 1 songs, 0 albums and 0 artists" elapsedTime=25.3ms query="\"\"" requestId=mydomain.local/0qAec3LZuY-002002 username=steve
Feb 17 13:13:16 mydomain.local navidrome[654025]: time="2024-02-17T13:13:16-05:00" level=debug msg="API: Successful response" endpoint=/rest/search2.view requestId=mydomain.local/0qAec3LZuY-002002 status=OK username=steve
Feb 17 13:13:16 mydomain.local navidrome[654025]: time="2024-02-17T13:13:16-05:00" level=debug msg="HTTP: POST http://myurl/rest/search2.view" elapsedTime=30.3ms httpStatus=200 remoteAddr=10.4.0.182 requestId=mydomain.local/0qAec3LZuY-002002 responseSize=1029 userAgent=insomnia/8.4.1

The problem, This returns a 200 response with 0 for Content-legth

curl --request POST \                                                                                                                                       ⇄
  --url 'https://myurl:443/rest/search2.view?=' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --header 'User-Agent: insomnia/8.4.1' \
  --cookie nd-player-7374657665=4d83963a-8936-4135-81d5-5779c4198f08 \
  --data u=steve \
  --data v=1.16.1 \
  --data c=insomnia \
  --data s=mys \
  --data t=beef \
  --data 'query=""' \
  --data artistCount=0 \
  --data artistOffset=0 \
  --data albumCount=0 \
  --data albumOffset=0 \
  --data songCount=1 \
  --data songOffset=6893 \
  --data f=json

In the LogLevel with logFormat = debug

Feb 17 13:13:56 mydomain.local navidrome[654025]: time="2024-02-17T13:13:56-05:00" level=debug msg="API: New request /rest/search2.view" client=insomnia requestId=mydomain.local/0qAec3LZuY-002003 username=steve version=1.16.1
Feb 17 13:13:56 mydomain.local navidrome[654025]: time="2024-02-17T13:13:56-05:00" level=debug msg="Search resulted in 1 songs, 0 albums and 0 artists" elapsedTime=25ms query="\"\"" requestId=mydomain.local/0qAec3LZuY-002003 username=steve
Feb 17 13:13:56 mydomain.local navidrome[654025]: time="2024-02-17T13:13:56-05:00" level=debug msg="API: Successful response" endpoint=/rest/search2.view requestId=mydomain.local/0qAec3LZuY-002003 status=OK username=steve
Feb 17 13:13:56 mydomain.local navidrome[654025]: time="2024-02-17T13:13:56-05:00" level=debug msg="HTTP: POST http://myurl/rest/search2.view" elapsedTime=30ms httpStatus=200 remoteAddr=10.4.0.182 requestId=mydomain.local/0qAec3LZuY-002003 responseSize=0 userAgent=insomnia/8.4.1

Notice that navidrome believes it sent back a response with one song.

I will mention that this problem started after I added ReplayGain to all of my mp3's.

Expected Behavior

Be able to get json result

Steps To Reproduce

Given above

Environment

- OS: Linux
- Browser: N/S
- Client: curl or insomnia

How Navidrome is installed?

Built from sources

Configuration

#LogLevel = 'info'
LogLevel = 'debug'
ScanSchedule = '@every 1h'
MusicFolder = "/vesmir/media/Music"
DataFolder = "/var/lib/navidrome/data"
PlaylistsPath = "playlists"
Scanner.GenreSeparators = ";,"
LastFM.Enabled = true
LastFM.ApiKey = "mykey"
LastFM.Secret = "mysecret" 
LastFM.Language = "en"

Relevant log output

Feb 17 13:13:16 mydomain.local navidrome[654025]: time="2024-02-17T13:13:16-05:00" level=debug msg="API: New request /rest/search2.view" client=insomnia requestId=mydomain.local/0qAec3LZuY-002002 username=steve version=1.16.1
Feb 17 13:13:16 mydomain.local navidrome[654025]: time="2024-02-17T13:13:16-05:00" level=debug msg="Search resulted in 1 songs, 0 albums and 0 artists" elapsedTime=25.3ms query="\"\"" requestId=mydomain.local/0qAec3LZuY-002002 username=steve
Feb 17 13:13:16 mydomain.local navidrome[654025]: time="2024-02-17T13:13:16-05:00" level=debug msg="API: Successful response" endpoint=/rest/search2.view requestId=mydomain.local/0qAec3LZuY-002002 status=OK username=steve
Feb 17 13:13:16 mydomain.local navidrome[654025]: time="2024-02-17T13:13:16-05:00" level=debug msg="HTTP: POST http://myurl/rest/search2.view" elapsedTime=30.3ms httpStatus=200 remoteAddr=10.4.0.182 requestId=mydomain.local/0qAec3LZuY-002002 responseSize=1029 userAgent=insomnia/8.4.1

Feb 17 13:13:56 mydomain.local navidrome[654025]: time="2024-02-17T13:13:56-05:00" level=debug msg="API: New request /rest/search2.view" client=insomnia requestId=mydomain.local/0qAec3LZuY-002003 username=steve version=1.16.1
Feb 17 13:13:56 mydomain.local navidrome[654025]: time="2024-02-17T13:13:56-05:00" level=debug msg="Search resulted in 1 songs, 0 albums and 0 artists" elapsedTime=25ms query="\"\"" requestId=mydomain.local/0qAec3LZuY-002003 username=steve
Feb 17 13:13:56 mydomain.local navidrome[654025]: time="2024-02-17T13:13:56-05:00" level=debug msg="API: Successful response" endpoint=/rest/search2.view requestId=mydomain.local/0qAec3LZuY-002003 status=OK username=steve
Feb 17 13:13:56 mydomain.local navidrome[654025]: time="2024-02-17T13:13:56-05:00" level=debug msg="HTTP: POST http://myurl/rest/search2.view" elapsedTime=30ms httpStatus=200 remoteAddr=10.4.0.182 requestId=mydomain.local/0qAec3LZuY-002003 responseSize=0 userAgent=insomnia/8.4.1

Anything else?

No response

Code of Conduct

deluan commented 6 months ago

Thanks for reporting. This is the same issue as #2862 , and is already fixed in master, but will only be released in the next version.

Please try again with the latest develop build and let me know the result. You should get a proper error in the response.

copart commented 6 months ago

Thank you.... I tried to find if this was already reported...

interestingly, I was coming back here to report that the problem seems to be the infinity value, lol.

Thank you again!

deluan commented 6 months ago

Closing as duplicate

github-actions[bot] commented 2 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.