mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Clean missing galleries (#489)
* Clean missing galleries * Refactor matchFile
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
package manager
|
||||
|
||||
import (
|
||||
"github.com/stashapp/stash/pkg/logger"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/stashapp/stash/pkg/logger"
|
||||
)
|
||||
|
||||
func excludeFiles(files []string, patterns []string) ([]string, int) {
|
||||
@@ -37,21 +38,13 @@ func excludeFiles(files []string, patterns []string) ([]string, int) {
|
||||
}
|
||||
|
||||
func matchFile(file string, patterns []string) bool {
|
||||
if patterns == nil {
|
||||
logger.Infof("No exclude patterns in config.")
|
||||
|
||||
} else {
|
||||
if patterns != nil {
|
||||
fileRegexps := generateRegexps(patterns)
|
||||
|
||||
if len(fileRegexps) == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, regPattern := range fileRegexps {
|
||||
if regPattern.MatchString(strings.ToLower(file)) {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user