From f8a28e443989d0ba9ddf31e269bea574f5f00a45 Mon Sep 17 00:00:00 2001 From: Boris Rybalkin Date: Thu, 11 Jun 2026 13:41:02 +0100 Subject: [PATCH] Make library scan symlink resolution configurable recurseFiles passes realPath:true to recursive-readdir-async, which resolves symlinks and returns the canonical real path of each file. The relative path is then computed as fullname.replace(folderPath, ''), which assumes fullname stays under folderPath. When the library folder is (or is under) a symlink, the resolved realpath no longer starts with folderPath, so the replace does nothing and the item path is rebuilt as folderPath + realpath -> a doubled, non-existent path, and the items fail to scan. Make resolution configurable via SCANNER_RESOLVE_SYMLINKS (default unchanged: resolves). Setting SCANNER_RESOLVE_SYMLINKS=0 keeps the folder path as given, so libraries on symlinked storage roots scan correctly. --- server/utils/fileUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/utils/fileUtils.js b/server/utils/fileUtils.js index 9a349bd54..1167782b1 100644 --- a/server/utils/fileUtils.js +++ b/server/utils/fileUtils.js @@ -199,7 +199,7 @@ module.exports.recurseFiles = async (path, relPathToReplace = null) => { ignoreFolders: true, extensions: true, deep: true, - realPath: true, + realPath: process.env.SCANNER_RESOLVE_SYMLINKS !== '0', normalizePath: false } let list = await rra.list(path, options)