feat: add hide dotfiles param (#1148)

This commit is contained in:
Tiger Nie
2020-11-20 18:51:28 +08:00
committed by GitHub
parent dcbc3286e2
commit 10e399b3c3
8 changed files with 55 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/tomasen/realip"
"github.com/filebrowser/filebrowser/v2/rules"
"github.com/filebrowser/filebrowser/v2/runner"
"github.com/filebrowser/filebrowser/v2/settings"
"github.com/filebrowser/filebrowser/v2/storage"
@@ -26,6 +27,10 @@ type data struct {
// Check implements rules.Checker.
func (d *data) Check(path string) bool {
if d.user.HideDotfiles && rules.MatchHidden(path) {
return false
}
allow := true
for _, rule := range d.settings.Rules {
if rule.Matches(path) {