From 63a97b3c40b7cc67ac49d75fa0ad9f207d501db7 Mon Sep 17 00:00:00 2001 From: Cutch Date: Mon, 24 Nov 2025 23:06:32 -0500 Subject: [PATCH] Add check for copied files --- server/scanner/LibraryScanner.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/scanner/LibraryScanner.js b/server/scanner/LibraryScanner.js index 79cc194f..142a73a2 100644 --- a/server/scanner/LibraryScanner.js +++ b/server/scanner/LibraryScanner.js @@ -718,6 +718,15 @@ async function findLibraryItemByItemToMetadata(fullPath, isSingleMedia) { const abMetadata = abmetadataGenerator.parseJson(metadataText) || {} // check if metadata id exists in the database const existingLibraryItem = await Database.libraryItemModel.getExpandedById(abMetadata.absId) - if (existingLibraryItem) Logger.debug(`[LibraryScanner] Found library item with metadata id matching one of "${abMetadata.absId}" at path "${existingLibraryItem.path}"`) + + if (existingLibraryItem) { + Logger.debug(`[LibraryScanner] Found library item with metadata id matching one of "${abMetadata.absId}" at path "${existingLibraryItem.path}"`) + + for (const { metadata } of existingLibraryItem.getLibraryFiles()) + if (await fs.pathExists(metadata.path)) { + Logger.debug(`[LibraryScanner] Conflicting library files exist "${metadata.path}"`) + return null + } + } return existingLibraryItem }