Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Check if playlist has any videos on it. #4696

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Fijxu
Copy link

@Fijxu Fijxu commented May 14, 2024

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

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`
@Fijxu Fijxu requested a review from a team as a code owner May 14, 2024 01:20
@Fijxu Fijxu requested review from syeopite and removed request for a team May 14, 2024 01:20
@Fijxu
Copy link
Author

Fijxu commented May 14, 2024

Can be tested with a empty playlist that I created at https://debuginv.nadeko.net/api/v1/playlists/PL5ASK6Z87scO0GrGbMzxVz5qvMhRUitbG

@SamantazFox SamantazFox added the need-testing This feature needs to be deployed and tested to see if it's working, and doesn't break something label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-testing This feature needs to be deployed and tested to see if it's working, and doesn't break something
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] API returns 403 with error "index out of bound" when calling a playlist with 0 videos
2 participants