You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
feat: add hide dotfiles param (#1148)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package rules
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
@@ -18,6 +19,12 @@ type Rule struct {
|
||||
Regexp *Regexp `json:"regexp"`
|
||||
}
|
||||
|
||||
// MatchHidden matches paths with a basename
|
||||
// that begins with a dot.
|
||||
func MatchHidden(path string) bool {
|
||||
return strings.HasPrefix(filepath.Base(path), ".")
|
||||
}
|
||||
|
||||
// Matches matches a path against a rule.
|
||||
func (r *Rule) Matches(path string) bool {
|
||||
if r.Regex {
|
||||
|
||||
Reference in New Issue
Block a user