diff --git a/server/finders/BookFinder.js b/server/finders/BookFinder.js index 7ba97ed14..8f2ddab0b 100644 --- a/server/finders/BookFinder.js +++ b/server/finders/BookFinder.js @@ -451,6 +451,7 @@ class BookFinder { } findChapters(asin, region) { + asin = asin.trim() return this.audnexus.getChaptersByASIN(asin, region) } } diff --git a/server/models/Author.js b/server/models/Author.js index c6537ec12..fef724d7a 100644 --- a/server/models/Author.js +++ b/server/models/Author.js @@ -35,7 +35,7 @@ class Author extends Model { return new oldAuthor({ id: this.id, asin: this.asin, - name: this.name, + name: this.name.trim(), description: this.description, imagePath: this.imagePath, libraryId: this.libraryId, @@ -66,7 +66,7 @@ class Author extends Model { static getFromOld(oldAuthor) { return { id: oldAuthor.id, - name: oldAuthor.name, + name: oldAuthor.name.trim(), lastFirst: oldAuthor.lastFirst, asin: oldAuthor.asin, description: oldAuthor.description, diff --git a/server/models/Book.js b/server/models/Book.js index 6b179c369..baee623e2 100644 --- a/server/models/Book.js +++ b/server/models/Book.js @@ -232,7 +232,7 @@ class Book extends Model { chapters: this.chapters?.map(c => ({ ...c })) || [], title: this.title, subtitle: this.subtitle, - authors: this.authors.map(a => a.name), + authors: this.authors.map(a => a.name.trim()), narrators: this.narrators, series: this.series.map(se => { const sequence = se.bookSeries?.sequence || '' diff --git a/server/models/LibraryItem.js b/server/models/LibraryItem.js index ee8a4bb86..a5e57de7e 100644 --- a/server/models/LibraryItem.js +++ b/server/models/LibraryItem.js @@ -351,7 +351,8 @@ class LibraryItem extends Model { for (const key in updatedMedia) { let existingValue = libraryItemExpanded.media[key] if (existingValue instanceof Date) existingValue = existingValue.valueOf() - + // Check for trimming. Why not instanceof? var str = "string" isn't instance of String + if (typeof updatedMedia[key] === "string") updatedMedia[key] = updatedMedia[key].trim() if (!areEquivalent(updatedMedia[key], existingValue, true)) { Logger.debug(`[LibraryItem] "${libraryItemExpanded.media.title}" ${libraryItemExpanded.mediaType}.${key} updated from ${existingValue} to ${updatedMedia[key]}`) hasMediaUpdates = true diff --git a/server/models/Series.js b/server/models/Series.js index 81c27a8bd..63659d2a5 100644 --- a/server/models/Series.js +++ b/server/models/Series.js @@ -30,7 +30,7 @@ class Series extends Model { getOldSeries() { return new oldSeries({ id: this.id, - name: this.name, + name: this.name.trim(), description: this.description, libraryId: this.libraryId, addedAt: this.createdAt.valueOf(),