Merge pull request #3414 from thatguy7/master

Improved handling of Authors and Series with names containing non-ASCII characters
This commit is contained in:
advplyr 2024-09-13 12:59:01 -05:00 committed by GitHub
commit 16ba6b53ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,6 @@
const { DataTypes, Model, where, fn, col } = require('sequelize') const { DataTypes, Model, where, fn, col } = require('sequelize')
const parseNameString = require('../utils/parsers/parseNameString') const parseNameString = require('../utils/parsers/parseNameString')
const { asciiOnlyToLowerCase } = require('../utils/index')
class Author extends Model { class Author extends Model {
constructor(values, options) { constructor(values, options) {
@ -55,7 +56,7 @@ class Author extends Model {
static async getByNameAndLibrary(authorName, libraryId) { static async getByNameAndLibrary(authorName, libraryId) {
return this.findOne({ return this.findOne({
where: [ where: [
where(fn('lower', col('name')), authorName.toLowerCase()), where(fn('lower', col('name')), asciiOnlyToLowerCase(authorName)),
{ {
libraryId libraryId
} }

View File

@ -1,6 +1,7 @@
const { DataTypes, Model, where, fn, col } = require('sequelize') const { DataTypes, Model, where, fn, col } = require('sequelize')
const { getTitlePrefixAtEnd } = require('../utils/index') const { getTitlePrefixAtEnd } = require('../utils/index')
const { asciiOnlyToLowerCase } = require('../utils/index')
class Series extends Model { class Series extends Model {
constructor(values, options) { constructor(values, options) {
@ -41,7 +42,7 @@ class Series extends Model {
static async getByNameAndLibrary(seriesName, libraryId) { static async getByNameAndLibrary(seriesName, libraryId) {
return this.findOne({ return this.findOne({
where: [ where: [
where(fn('lower', col('name')), seriesName.toLowerCase()), where(fn('lower', col('name')), asciiOnlyToLowerCase(seriesName)),
{ {
libraryId libraryId
} }