mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-22 08:53:41 +02:00
Update:Validate ASIN for author, chapter and match requests
This commit is contained in:
parent
ee501f70ed
commit
a018374d26
5 changed files with 72 additions and 45 deletions
|
@ -9,7 +9,7 @@ const CacheManager = require('../managers/CacheManager')
|
|||
const CoverManager = require('../managers/CoverManager')
|
||||
const AuthorFinder = require('../finders/AuthorFinder')
|
||||
|
||||
const { reqSupportsWebp } = require('../utils/index')
|
||||
const { reqSupportsWebp, isValidASIN } = require('../utils/index')
|
||||
|
||||
const naturalSort = createNewSortInstance({
|
||||
comparer: new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' }).compare
|
||||
|
@ -252,7 +252,7 @@ class AuthorController {
|
|||
async match(req, res) {
|
||||
let authorData = null
|
||||
const region = req.body.region || 'us'
|
||||
if (req.body.asin) {
|
||||
if (req.body.asin && isValidASIN(req.body.asin.toUpperCase?.())) {
|
||||
authorData = await AuthorFinder.findAuthorByASIN(req.body.asin, region)
|
||||
} else {
|
||||
authorData = await AuthorFinder.findAuthorByName(req.body.q, region)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue