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:
WithoutPants
2021-02-02 07:57:56 +11:00
committed by GitHub
parent 4fd022a93b
commit e4d91a0226
24 changed files with 354 additions and 204 deletions

View File

@@ -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
}