mirror of
https://github.com/ramsayleung/rspotify.git
synced 2026-04-25 23:45:52 +03:00
[GH-ISSUE #459] json parse error when getting playlist with no image #153
Labels
No labels
Stale
bug
discussion
enhancement
good first issue
good first issue
help wanted
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/rspotify#153
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aome510 on GitHub (Feb 24, 2024).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/459
Describe the bug
Calling
get-playlistAPI with playlist having no image will return a response withimagesfieldnull. However, according to https://docs.rs/rspotify-model/0.12.0/rspotify_model/playlist/struct.FullPlaylist.html,rspotifyspecifies the field asVec<Image>. This leads to the following error when parsing the json response:To Reproduce
Steps to reproduce the behavior:
get-playlistAPI using the new playlist's URIimagesfield has a value ofnull@ramsayleung commented on GitHub (Feb 27, 2024):
I was unable to reproduce this problem:
The
imagesfield from the response is empty rather than has a value ofnull:@aome510 commented on GitHub (Feb 29, 2024):
Pretty weird. My playlist is public, you can try mine instead. The id is
2gaCJBCZ1h90ZdIjNV6SWw.@ramsayleung commented on GitHub (Feb 29, 2024):
Could you provide the code snippet you were using when you encountered this error?
@aome510 commented on GitHub (Feb 29, 2024):
Not sure what you mean by code snippet. I encountered this error when testing https://github.com/aome510/spotify-player/pull/379. After creating new playlist with
create-playlistAPI, I couldn't enter the playlist page because the client fails to retrieve new playlist's data.@ramsayleung commented on GitHub (Mar 1, 2024):
Even though I change the test playlist id to yours, I'm still unable to reproduce this error, the
imagesfield is deserialized as an empty vector, rather than throwing an error:@aome510 commented on GitHub (Mar 1, 2024):
hmmm, interesting. Maybe the result is user-specific 🤔 .That said, it's not a breaking change to add
#serde(default)forimagesfield ofFullPlaylistandSimplifiedPlaylistright?@ramsayleung commented on GitHub (Mar 1, 2024):
#[serde(default)]is not considered a breaking change, then, what's the point of this?@aome510 commented on GitHub (Mar 1, 2024):
It will help to not throw an error when parsing playlist with null
imagesfield@BeauCranston commented on GitHub (Mar 22, 2024):
Hello, I just encountered an error similar to this and my problem was that I had a playlist that was empty however I am on version 0.10 since I am using spotify-tui so this may be irrelevant but thought I would leave this here just in case.
As soon as I added a song to my empty playlist everything worked fine.
@trumank commented on GitHub (Mar 28, 2024):
It seems Spotify is returning different responses (the
imagefield specifically) depending on the account/bearer token used.Using rspotify's test account bearer:
Using the bearer token for my personal account obtained from ncspot's log:
@trumank commented on GitHub (Mar 28, 2024):
And this patch allows playlists to load for me in
ncspot:@aome510 commented on GitHub (Mar 28, 2024):
#[serde(default)]should be enough@trumank commented on GitHub (Mar 28, 2024):
#[serde(default)]will fail if the key is present with a null value:@aome510 commented on GitHub (Mar 28, 2024):
I see, thanks for testing it.
@Icelk commented on GitHub (Apr 1, 2024):
In the meantime, one may use the API to check which playlist is the culprit. Go the the spotify API documentation link below and test the query with limit = 50 offset = 0 on your own account (you need to be logged in):
https://developer.spotify.com/documentation/web-api/reference/get-a-list-of-current-users-playlists
Then Ctrl+F for
"images": null@00alia00 commented on GitHub (Apr 8, 2024):
@Icelk Thanks, that was a life saver! An empty playlist (and therefore no image) was killing it for me! Adding an image to the playlist fixed it.
@trumank commented on GitHub (Jun 3, 2024):
I believe this should be closed now that #480 is merged?
@ramsayleung commented on GitHub (Jun 3, 2024):
Closing this issue as the problem has been resolved in #480 .
@flrgh commented on GitHub (Jun 3, 2024):
Thanks @ramsayleung! Would you be able to cut a patch release for this fix? I have been sourcing this dep from master, but it would be nice to switch back to a release.
@ramsayleung commented on GitHub (Jun 4, 2024):
The patch release
v.0.13.2has been release #485 :-)