mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Fix:Library search API endpoint /libraries/:id/search to check that query param q is a valid string
This commit is contained in:
		
							parent
							
								
									f2f2ea161c
								
							
						
					
					
						commit
						10b1784f6d
					
				| @ -552,8 +552,8 @@ class LibraryController { | |||||||
|    * @param {import('express').Response} res  |    * @param {import('express').Response} res  | ||||||
|    */ |    */ | ||||||
|   async search(req, res) { |   async search(req, res) { | ||||||
|     if (!req.query.q) { |     if (!req.query.q || typeof req.query.q !== 'string') { | ||||||
|       return res.status(400).send('No query string') |       return res.status(400).send('Invalid request. Query param "q" must be a string') | ||||||
|     } |     } | ||||||
|     const limit = req.query.limit && !isNaN(req.query.limit) ? Number(req.query.limit) : 12 |     const limit = req.query.limit && !isNaN(req.query.limit) ? Number(req.query.limit) : 12 | ||||||
|     const query = asciiOnlyToLowerCase(req.query.q.trim()) |     const query = asciiOnlyToLowerCase(req.query.q.trim()) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user