mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-11-03 19:07:00 -05:00 
			
		
		
		
	Merge pull request #3414 from thatguy7/master
Improved handling of Authors and Series with names containing non-ASCII characters
This commit is contained in:
		
						commit
						16ba6b53ba
					
				@ -1,5 +1,6 @@
 | 
			
		||||
const { DataTypes, Model, where, fn, col } = require('sequelize')
 | 
			
		||||
const parseNameString = require('../utils/parsers/parseNameString')
 | 
			
		||||
const { asciiOnlyToLowerCase } = require('../utils/index')
 | 
			
		||||
 | 
			
		||||
class Author extends Model {
 | 
			
		||||
  constructor(values, options) {
 | 
			
		||||
@ -55,7 +56,7 @@ class Author extends Model {
 | 
			
		||||
  static async getByNameAndLibrary(authorName, libraryId) {
 | 
			
		||||
    return this.findOne({
 | 
			
		||||
      where: [
 | 
			
		||||
        where(fn('lower', col('name')), authorName.toLowerCase()),
 | 
			
		||||
        where(fn('lower', col('name')), asciiOnlyToLowerCase(authorName)),
 | 
			
		||||
        {
 | 
			
		||||
          libraryId
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,7 @@
 | 
			
		||||
const { DataTypes, Model, where, fn, col } = require('sequelize')
 | 
			
		||||
 | 
			
		||||
const { getTitlePrefixAtEnd } = require('../utils/index')
 | 
			
		||||
const { asciiOnlyToLowerCase } = require('../utils/index')
 | 
			
		||||
 | 
			
		||||
class Series extends Model {
 | 
			
		||||
  constructor(values, options) {
 | 
			
		||||
@ -41,7 +42,7 @@ class Series extends Model {
 | 
			
		||||
  static async getByNameAndLibrary(seriesName, libraryId) {
 | 
			
		||||
    return this.findOne({
 | 
			
		||||
      where: [
 | 
			
		||||
        where(fn('lower', col('name')), seriesName.toLowerCase()),
 | 
			
		||||
        where(fn('lower', col('name')), asciiOnlyToLowerCase(seriesName)),
 | 
			
		||||
        {
 | 
			
		||||
          libraryId
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user