mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-18 13:42:07 +08:00
4fd394bead
RetrieveWithMediaFiles drops queue entries whose tracks are no longer in the library (purged, or in a library the user lost access to), but it kept the stored current index. That index then pointed one track further for each dropped track before it, so getPlayQueue, getPlayQueueByIndex and GET /api/queue reported the wrong song with the old position. The current index is now remapped to the same track in the filtered list. If the current track itself is gone, the queue moves to the next remaining track (or the last one) and restarts it. The cleaned queue is then saved back in the background, so partial PUT /api/queue updates use the same list the client sees. The save is a conditional UPDATE that only applies if the row is unchanged since it was read, so it never undoes a newer client save, and it is skipped if loading the tracks failed. Fixes #6297