invidious
invidious copied to clipboard
API: Check if playlist has any videos on it.
Invidious assumes that every playlist will have at least one video because it needs to check for the index
key. So if there is no videos on a playlist, there is no index
key and Invidious throws Index out of bounds
This fixes this API endpoints when there is no videos in a playlist:
api/v1/playlists/:plid
api/v1/auth/playlists/:plid
For some weird reason, the api/v1/auth/playlists/:plid
endpoint was able the return the error Index out of bounds
as said in #4679 but api/v1/playlists/:plid
did not return anything. Weird
Fixes #4679
Can be tested with a empty playlist that I created at https://debuginv.nadeko.net/api/v1/playlists/PL5ASK6Z87scO0GrGbMzxVz5qvMhRUitbG
For some weird reason, the
api/v1/auth/playlists/:plid
endpoint was able the return the errorIndex out of bounds
as said in #4679 butapi/v1/playlists/:plid
did not return anything. Weird
This because the authentication middleware (AuthHandler
) catches the error and displays it nicely:
https://github.com/iv-org/invidious/blob/bad92093bff66bfb0281e5276fa0e136a61ba330/src/invidious/helpers/handlers.cr#L127-L133
Thank you for fixing this :)