mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Fix:Crash when updating book author or series that includes an apostrophe #2070
This commit is contained in:
		
							parent
							
								
									f1a7fd0d50
								
							
						
					
					
						commit
						ab97a9d613
					
				| @ -114,11 +114,14 @@ class Author extends Model { | |||||||
|   static async getOldByNameAndLibrary(authorName, libraryId) { |   static async getOldByNameAndLibrary(authorName, libraryId) { | ||||||
|     const author = (await this.findOne({ |     const author = (await this.findOne({ | ||||||
|       where: [ |       where: [ | ||||||
|         literal(`name = '${authorName}' COLLATE NOCASE`), |         literal(`name = ':authorName' COLLATE NOCASE`), | ||||||
|         { |         { | ||||||
|           libraryId |           libraryId | ||||||
|         } |         } | ||||||
|       ] |       ], | ||||||
|  |       replacements: { | ||||||
|  |         authorName | ||||||
|  |       } | ||||||
|     }))?.getOldAuthor() |     }))?.getOldAuthor() | ||||||
|     return author |     return author | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -105,11 +105,14 @@ class Series extends Model { | |||||||
|   static async getOldByNameAndLibrary(seriesName, libraryId) { |   static async getOldByNameAndLibrary(seriesName, libraryId) { | ||||||
|     const series = (await this.findOne({ |     const series = (await this.findOne({ | ||||||
|       where: [ |       where: [ | ||||||
|         literal(`name = '${seriesName}' COLLATE NOCASE`), |         literal(`name = ':seriesName' COLLATE NOCASE`), | ||||||
|         { |         { | ||||||
|           libraryId |           libraryId | ||||||
|         } |         } | ||||||
|       ] |       ], | ||||||
|  |       replacements: { | ||||||
|  |         seriesName | ||||||
|  |       } | ||||||
|     }))?.getOldSeries() |     }))?.getOldSeries() | ||||||
|     return series |     return series | ||||||
|   } |   } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user