mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-05-13 23:11:29 +00:00
Update author & library item image endpoints to clamp width/height query params
This commit is contained in:
parent
88667d00a1
commit
455e605162
3 changed files with 16 additions and 6 deletions
|
|
@ -54,6 +54,16 @@ module.exports.isNullOrNaN = (num) => {
|
|||
return num === null || isNaN(num)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number|null|undefined} value
|
||||
* @param {number} max
|
||||
* @returns {number|null}
|
||||
*/
|
||||
module.exports.clampPositiveInt = (value, max) => {
|
||||
if (value == null || !Number.isFinite(value) || value <= 0) return null
|
||||
return Math.min(Math.floor(value), max)
|
||||
}
|
||||
|
||||
const xmlToJSON = (xml) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
parseString(xml, (err, results) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue