From 2c77f1fc5a779bd157f76655ac7a7b653a3cb329 Mon Sep 17 00:00:00 2001 From: Tiberiu Ichim Date: Sun, 15 Feb 2026 20:51:39 +0200 Subject: [PATCH] Fix TypeError: checkIsNotConsolidated_FolderName is not a function by making it static --- server/controllers/LibraryItemController.js | 6 ++---- server/models/LibraryItem.js | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/server/controllers/LibraryItemController.js b/server/controllers/LibraryItemController.js index 3cc4179f2..c36439997 100644 --- a/server/controllers/LibraryItemController.js +++ b/server/controllers/LibraryItemController.js @@ -1655,8 +1655,7 @@ class LibraryItemController { const author = req.libraryItem.media.authors?.[0]?.name || 'Unknown Author' const title = req.libraryItem.media.title || 'Unknown Title' - const newFolderName = `${author} - ${title}` - const sanitizedFolderName = sanitizeFilename(newFolderName) + const sanitizedFolderName = Database.libraryItemModel.getConsolidatedFolderName(author, title) const library = await Database.libraryModel.findByIdWithFolders(req.libraryItem.libraryId) // Find the library folder that currently contains this item @@ -1719,8 +1718,7 @@ class LibraryItemController { try { const author = libraryItem.media.authors?.[0]?.name || 'Unknown Author' const title = libraryItem.media.title || 'Unknown Title' - const newFolderName = `${author} - ${title}` - const sanitizedFolderName = sanitizeFilename(newFolderName) + const sanitizedFolderName = Database.libraryItemModel.getConsolidatedFolderName(author, title) const library = await Database.libraryModel.findByIdWithFolders(libraryItem.libraryId) const currentLibraryFolder = library.libraryFolders.find((lf) => libraryItem.path.startsWith(lf.path)) || library.libraryFolders[0] diff --git a/server/models/LibraryItem.js b/server/models/LibraryItem.js index c71e02d64..085b349f7 100644 --- a/server/models/LibraryItem.js +++ b/server/models/LibraryItem.js @@ -925,12 +925,12 @@ class LibraryItem extends Model { if (this.isFile) return true const author = this.authorNamesFirstLast?.split(',')[0]?.trim() || 'Unknown Author' const title = this.title || 'Unknown Title' - const folderName = this.checkIsNotConsolidated_FolderName(author, title) + const folderName = LibraryItem.getConsolidatedFolderName(author, title) const currentFolderName = Path.basename(this.path.replace(/[\/\\]$/, '')) return currentFolderName !== folderName } - checkIsNotConsolidated_FolderName(author, title) { + static getConsolidatedFolderName(author, title) { return sanitizeFilename(`${author} - ${title}`) }