mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
String regex filter criteria and selective autotag (#1082)
* Add regex string filter criterion * Use query interface for auto tagging * Use Query interface for filename parser * Remove query regex interfaces * Add selective auto tag * Use page size 0 as no limit
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/h2non/filetype"
|
||||
"github.com/h2non/filetype/types"
|
||||
@@ -269,3 +270,16 @@ func MatchEntries(dir, pattern string) ([]string, error) {
|
||||
}
|
||||
return res, err
|
||||
}
|
||||
|
||||
// IsPathInDir returns true if pathToCheck is within dir.
|
||||
func IsPathInDir(dir, pathToCheck string) bool {
|
||||
rel, err := filepath.Rel(dir, pathToCheck)
|
||||
|
||||
if err == nil {
|
||||
if !strings.HasPrefix(rel, ".."+string(filepath.Separator)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user