mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-01 05:29:41 +00:00
Fix case-insensitive lookup for series and authors during import
When importing books, the filter data cache was using case-sensitive lookups for series and author names, while the database fallback used case-insensitive matching. This inconsistency caused duplicate series and authors to be created when names differed only in casing (e.g., "Harry Potter" vs "harry potter"). Now both paths use case-insensitive comparison. Fixes #4255 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
122fc34a75
commit
0ed641f0b1
1 changed files with 6 additions and 2 deletions
|
|
@ -624,7 +624,9 @@ class Database {
|
|||
if (!this.libraryFilterData[libraryId]) {
|
||||
return (await this.authorModel.getByNameAndLibrary(authorName, libraryId))?.id || null
|
||||
}
|
||||
return this.libraryFilterData[libraryId].authors.find((au) => au.name === authorName)?.id || null
|
||||
// Case-insensitive comparison to match getByNameAndLibrary behavior
|
||||
const authorNameLower = authorName.toLowerCase()
|
||||
return this.libraryFilterData[libraryId].authors.find((au) => au.name.toLowerCase() === authorNameLower)?.id || null
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -638,7 +640,9 @@ class Database {
|
|||
if (!this.libraryFilterData[libraryId]) {
|
||||
return (await this.seriesModel.getByNameAndLibrary(seriesName, libraryId))?.id || null
|
||||
}
|
||||
return this.libraryFilterData[libraryId].series.find((se) => se.name === seriesName)?.id || null
|
||||
// Case-insensitive comparison to match getByNameAndLibrary behavior
|
||||
const seriesNameLower = seriesName.toLowerCase()
|
||||
return this.libraryFilterData[libraryId].series.find((se) => se.name.toLowerCase() === seriesNameLower)?.id || null
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue