mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-04-25 23:06:43 +02:00
Update author & library item image endpoints to clamp width/height query params
This commit is contained in:
@@ -10,7 +10,7 @@ const CacheManager = require('../managers/CacheManager')
|
||||
const CoverManager = require('../managers/CoverManager')
|
||||
const AuthorFinder = require('../finders/AuthorFinder')
|
||||
|
||||
const { reqSupportsWebp, isValidASIN } = require('../utils/index')
|
||||
const { reqSupportsWebp, isValidASIN, clampPositiveInt } = require('../utils/index')
|
||||
|
||||
const naturalSort = createNewSortInstance({
|
||||
comparer: new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' }).compare
|
||||
@@ -412,8 +412,8 @@ class AuthorController {
|
||||
|
||||
const options = {
|
||||
format: format || (reqSupportsWebp(req) ? 'webp' : 'jpeg'),
|
||||
height: height ? parseInt(height) : null,
|
||||
width: width ? parseInt(width) : null
|
||||
height: clampPositiveInt(height ? parseInt(height) : null, 4096),
|
||||
width: clampPositiveInt(width ? parseInt(width) : null, 4096)
|
||||
}
|
||||
return CacheManager.handleAuthorCache(res, authorId, options)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ const SocketAuthority = require('../SocketAuthority')
|
||||
const Database = require('../Database')
|
||||
|
||||
const zipHelpers = require('../utils/zipHelpers')
|
||||
const { reqSupportsWebp } = require('../utils/index')
|
||||
const { reqSupportsWebp, clampPositiveInt } = require('../utils/index')
|
||||
const { ScanResult, AudioMimeType } = require('../utils/constants')
|
||||
const { getAudioMimeTypeFromExtname, encodeUriPath } = require('../utils/fileUtils')
|
||||
const LibraryItemScanner = require('../scanner/LibraryItemScanner')
|
||||
@@ -398,8 +398,8 @@ class LibraryItemController {
|
||||
|
||||
const options = {
|
||||
format: format || (reqSupportsWebp(req) ? 'webp' : 'jpeg'),
|
||||
height: height ? parseInt(height) : null,
|
||||
width: width ? parseInt(width) : null
|
||||
height: clampPositiveInt(height ? parseInt(height) : null, 4096),
|
||||
width: clampPositiveInt(width ? parseInt(width) : null, 4096)
|
||||
}
|
||||
return CacheManager.handleCoverCache(res, libraryItemId, options)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user