fix(scanner, watcher): handle errors when pushing ignore patterns for folders

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan 2025-11-11 21:10:34 -05:00
parent e222d8d8db
commit 2998cd3f7c
2 changed files with 10 additions and 3 deletions

View File

@ -34,10 +34,14 @@ func walkDirTree(ctx context.Context, job *scanJob, targetFolders ...string) (<-
// Create checker and push patterns from root to this folder
checker := newIgnoreChecker(job.fs)
_ = checker.PushAllParents(ctx, folderPath)
err := checker.PushAllParents(ctx, folderPath)
if err != nil {
log.Error(ctx, "Scanner: Error pushing ignore patterns for target folder", "path", folderPath, err)
continue
}
// Recursively walk this folder and all its children
err := walkFolder(ctx, job, folderPath, checker, results)
err = walkFolder(ctx, job, folderPath, checker, results)
if err != nil {
log.Error(ctx, "Scanner: Error walking target folder", "path", folderPath, err)
continue

View File

@ -308,7 +308,10 @@ func resolveFolderPath(fsys fs.FS, path string) string {
// in the library. It pushes all parent folders onto the IgnoreChecker stack before checking.
func (w *watcher) shouldIgnoreFolderPath(ctx context.Context, fsys storage.MusicFS, folderPath string) bool {
checker := newIgnoreChecker(fsys)
_ = checker.PushAllParents(ctx, folderPath)
err := checker.PushAllParents(ctx, folderPath)
if err != nil {
log.Warn(ctx, "Watcher: Error pushing ignore patterns for folder", "path", folderPath, err)
}
return checker.ShouldIgnore(ctx, folderPath)
}