mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01: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 { 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
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user