mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-11-07 16:44:16 +01:00
Fix:Handle undefined page/limit in paginated library queries #3499
This commit is contained in:
parent
33eae1e03a
commit
076f71d490
@ -492,8 +492,8 @@ class LibraryController {
|
|||||||
const payload = {
|
const payload = {
|
||||||
results: [],
|
results: [],
|
||||||
total: undefined,
|
total: undefined,
|
||||||
limit: req.query.limit,
|
limit: req.query.limit || 0,
|
||||||
page: req.query.page,
|
page: req.query.page || 0,
|
||||||
sortBy: req.query.sort,
|
sortBy: req.query.sort,
|
||||||
sortDesc: req.query.desc === '1',
|
sortDesc: req.query.desc === '1',
|
||||||
filterBy: req.query.filter,
|
filterBy: req.query.filter,
|
||||||
@ -594,8 +594,8 @@ class LibraryController {
|
|||||||
const payload = {
|
const payload = {
|
||||||
results: [],
|
results: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
limit: req.query.limit,
|
limit: req.query.limit || 0,
|
||||||
page: req.query.page,
|
page: req.query.page || 0,
|
||||||
sortBy: req.query.sort,
|
sortBy: req.query.sort,
|
||||||
sortDesc: req.query.desc === '1',
|
sortDesc: req.query.desc === '1',
|
||||||
filterBy: req.query.filter,
|
filterBy: req.query.filter,
|
||||||
@ -666,8 +666,8 @@ class LibraryController {
|
|||||||
const payload = {
|
const payload = {
|
||||||
results: [],
|
results: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
limit: req.query.limit,
|
limit: req.query.limit || 0,
|
||||||
page: req.query.page,
|
page: req.query.page || 0,
|
||||||
sortBy: req.query.sort,
|
sortBy: req.query.sort,
|
||||||
sortDesc: req.query.desc === '1',
|
sortDesc: req.query.desc === '1',
|
||||||
filterBy: req.query.filter,
|
filterBy: req.query.filter,
|
||||||
@ -702,8 +702,8 @@ class LibraryController {
|
|||||||
const payload = {
|
const payload = {
|
||||||
results: [],
|
results: [],
|
||||||
total: playlistsForUser.length,
|
total: playlistsForUser.length,
|
||||||
limit: req.query.limit,
|
limit: req.query.limit || 0,
|
||||||
page: req.query.page
|
page: req.query.page || 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payload.limit) {
|
if (payload.limit) {
|
||||||
@ -1139,8 +1139,8 @@ class LibraryController {
|
|||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
episodes: [],
|
episodes: [],
|
||||||
limit: req.query.limit,
|
limit: req.query.limit || 0,
|
||||||
page: req.query.page
|
page: req.query.page || 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const offset = payload.page * payload.limit
|
const offset = payload.page * payload.limit
|
||||||
|
Loading…
Reference in New Issue
Block a user