Fix public user playlist 404 error on download and play
This commit is contained in:
parent
89b8e7e24b
commit
d74eca943c
2 changed files with 19 additions and 4 deletions
12
js/app.js
12
js/app.js
|
|
@ -301,10 +301,18 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
|
||||
try {
|
||||
let playlist, tracks;
|
||||
const userPlaylist = await db.getPlaylist(playlistId);
|
||||
let userPlaylist = await db.getPlaylist(playlistId);
|
||||
|
||||
if (!userPlaylist) {
|
||||
try {
|
||||
userPlaylist = await syncManager.getPublicPlaylist(playlistId);
|
||||
} catch (e) {
|
||||
// Not a public playlist
|
||||
}
|
||||
}
|
||||
|
||||
if (userPlaylist) {
|
||||
playlist = { ...userPlaylist, title: userPlaylist.name };
|
||||
playlist = { ...userPlaylist, title: userPlaylist.name || userPlaylist.title };
|
||||
tracks = userPlaylist.tracks || [];
|
||||
} else {
|
||||
const data = await api.getPlaylist(playlistId);
|
||||
|
|
|
|||
11
js/events.js
11
js/events.js
|
|
@ -399,8 +399,15 @@ export async function handleTrackAction(action, item, player, api, lyricsManager
|
|||
const data = await api.getPlaylist(item.uuid);
|
||||
tracks = data.tracks;
|
||||
} else if (type === 'user-playlist') {
|
||||
const playlist = await db.getPlaylist(item.id);
|
||||
tracks = playlist ? playlist.tracks : [];
|
||||
let playlist = await db.getPlaylist(item.id);
|
||||
if (!playlist) {
|
||||
try {
|
||||
playlist = await syncManager.getPublicPlaylist(item.id);
|
||||
} catch (e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
tracks = playlist ? playlist.tracks : (item.tracks || []);
|
||||
}
|
||||
|
||||
if (tracks.length > 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue