mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Shortcut scan walk for excluded folders (#1382)
* Shortcut scan walk for excluded folders * Add note to manual * Add changelog entry
This commit is contained in:
@@ -1098,6 +1098,13 @@ func walkFilesToScan(s *models.StashConfig, f filepath.WalkFunc) error {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
|
||||
// shortcut: skip the directory entirely if it matches both exclusion patterns
|
||||
// add a trailing separator so that it correctly matches against patterns like path/.*
|
||||
pathExcludeTest := path + string(filepath.Separator)
|
||||
if (s.ExcludeVideo || matchFileRegex(pathExcludeTest, excludeVidRegex)) && (s.ExcludeImage || matchFileRegex(pathExcludeTest, excludeImgRegex)) {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user