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.
This commit is contained in:
Boris Rybalkin 2026-06-11 13:41:02 +01:00
parent cbda0360aa
commit f8a28e4439

View file

@ -199,7 +199,7 @@ module.exports.recurseFiles = async (path, relPathToReplace = null) => {
ignoreFolders: true, ignoreFolders: true,
extensions: true, extensions: true,
deep: true, deep: true,
realPath: true, realPath: process.env.SCANNER_RESOLVE_SYMLINKS !== '0',
normalizePath: false normalizePath: false
} }
let list = await rra.list(path, options) let list = await rra.list(path, options)