From fe9e2752df0dd477439fd9ac2dad758ce5911545 Mon Sep 17 00:00:00 2001 From: Marco Herrn Date: Tue, 20 Jul 2021 20:39:11 +0200 Subject: [PATCH] Treat symlinks to directories like directories It seems that the first try was not enough. Now symlinks should be detected in all cases. --- api/scanner/scanner_user.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/scanner/scanner_user.go b/api/scanner/scanner_user.go index c0248b9d..ab0d1e13 100644 --- a/api/scanner/scanner_user.go +++ b/api/scanner/scanner_user.go @@ -256,7 +256,14 @@ func directoryContainsPhotos(rootPath string, cache *scanner_cache.AlbumScannerC for _, fileInfo := range dirContent { filePath := path.Join(dirPath, fileInfo.Name()) - if fileInfo.IsDir() { + + isDirSymlink, err := utils.IsDirSymlink(filePath) + if err != nil { + log.Printf("Cannot detect whether %s is symlink to a directory. Pretending it is not", filePath) + isDirSymlink = false + } + + if fileInfo.IsDir() || isDirSymlink { scanQueue.PushBack(filePath) } else { if cache.IsPathMedia(filePath) {