mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-01 05:29:41 +00:00
Fix TypeError: checkIsNotConsolidated_FolderName is not a function by making it static
This commit is contained in:
parent
8f189763f0
commit
2c77f1fc5a
2 changed files with 4 additions and 6 deletions
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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}`)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue