1
0
Fork 0
mirror of https://github.com/librespot-org/librespot.git synced 2025-10-04 10:19:27 +02:00

Fix playlist metadata fields parsing (#1019)

Some fields were wrongly parsed as `SpotifyId`s, although they do not
always encode exactly 16 bytes in practice. Also, some optional fields
caused `[]` to be parsed as `SpotifyId`, which obviously failed as well.
This commit is contained in:
eladyn 2022-07-28 18:46:16 +02:00 committed by GitHub
parent 05b9b13cf8
commit 88f7cdbb44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 32 deletions

View file

@ -1,5 +1,5 @@
use std::{
convert::{TryFrom, TryInto},
convert::TryFrom,
ops::{Deref, DerefMut},
};
@ -152,7 +152,7 @@ impl TryFrom<CdnUrlMessage> for MaybeExpiringUrls {
Ok(MaybeExpiringUrl(
cdn_url.to_owned(),
Some(expiry.try_into()?),
Some(Date::from_timestamp_ms(expiry * 1000)?),
))
} else {
Ok(MaybeExpiringUrl(cdn_url.to_owned(), None))