Treat symlinks to directories like directories

This allows symlinking to create additional subalbums.

Closes: #431
This commit is contained in:
Marco Herrn
2021-07-15 16:16:05 +02:00
parent 2e4f83abbf
commit 0129cb7703
4 changed files with 125 additions and 2 deletions

View File

@@ -181,7 +181,13 @@ func findMediaForAlbum(album *models.Album, cache *scanner_cache.AlbumScannerCac
for _, item := range dirContent {
photoPath := path.Join(album.Path, item.Name())
if !item.IsDir() && cache.IsPathMedia(photoPath) {
isDirSymlink, err := utils.IsDirSymlink(photoPath)
if err != nil {
log.Printf("Cannot detect whether %s is symlink to a directory. Pretending it is not", photoPath)
isDirSymlink = false
}
if !item.IsDir() && !isDirSymlink && cache.IsPathMedia(photoPath) {
// Match file against ignore data
if albumIgnore.MatchesPath(item.Name()) {
log.Printf("File %s ignored\n", item.Name())