API: Fix out of bound error on empty playlists#4696
Merged
Conversation
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`
Member
Author
|
Can be tested with a empty playlist that I created at https://debuginv.nadeko.net/api/v1/playlists/PL5ASK6Z87scO0GrGbMzxVz5qvMhRUitbG |
SamantazFox
approved these changes
May 20, 2024
Member
This because the authentication middleware ( invidious/src/invidious/helpers/handlers.cr Lines 127 to 133 in bad9209 |
Member
|
Thank you for fixing this :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Invidious assumes that every playlist will have at least one video because it needs to check for the
indexkey. So if there is no videos on a playlist, there is noindexkey and Invidious throwsIndex out of boundsThis fixes this API endpoints when there is no videos in a playlist:
For some weird reason, the
api/v1/auth/playlists/:plidendpoint was able the return the errorIndex out of boundsas said in #4679 butapi/v1/playlists/:pliddid not return anything. WeirdFixes #4679