Skip to content

Commit

Permalink
Fix:Error going to local library item page that is storing an old ser…
Browse files Browse the repository at this point in the history
…ver library item id when server is now using new ids #953
  • Loading branch information
advplyr committed Nov 25, 2023
1 parent e8abb18 commit 88fbebe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pages/item/_id/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ export default {
libraryItem = await app.$db.getLocalLibraryItem(libraryItemId)
console.log('Got lli', libraryItemId)
// If library item is linked to the currently connected server then redirect to the page using the server library item id
if (libraryItem?.libraryItemId && libraryItem?.serverAddress === store.getters['user/getServerAddress'] && store.state.networkConnected) {
if (libraryItem?.libraryItemId?.startsWith('li_')) {
// Detect old library item id
console.error('Local library item has old server library item id', libraryItem.libraryItemId)
} else if (libraryItem?.libraryItemId && libraryItem?.serverAddress === store.getters['user/getServerAddress'] && store.state.networkConnected) {
let query = ''
if (libraryItem.mediaType === 'podcast') query = '?episodefilter=downloaded' // Filter by downloaded when redirecting from the local copy
return redirect(`/item/${libraryItem.libraryItemId}${query}`)
Expand Down
8 changes: 7 additions & 1 deletion plugins/nativeHttp.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ export default function ({ store }, inject) {
data,
headers,
...options
}).then(res => res.data)
}).then(res => {
if (res.status >= 400) {
console.error(`[nativeHttp] ${res.status} status for url "${url}"`)
throw new Error(res.data)
}
return res.data
})
},
get(url, options = {}) {
return this.request('GET', url, undefined, options)
Expand Down

0 comments on commit 88fbebe

Please sign in to comment.