|
|
@ -170,10 +170,10 @@ func (r *Rules) parseRule(rule string) error {
|
|
|
|
rule = strings.TrimSuffix(rule, "/")
|
|
|
|
rule = strings.TrimSuffix(rule, "/")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if strings.HasPrefix(rule, "/") {
|
|
|
|
if after, ok := strings.CutPrefix(rule, "/"); ok {
|
|
|
|
// Require path matches the root path.
|
|
|
|
// Require path matches the root path.
|
|
|
|
p.match = func(n string, _ os.FileInfo) bool {
|
|
|
|
p.match = func(n string, _ os.FileInfo) bool {
|
|
|
|
rule = strings.TrimPrefix(rule, "/")
|
|
|
|
rule = after
|
|
|
|
ok, err := filepath.Match(rule, n)
|
|
|
|
ok, err := filepath.Match(rule, n)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
slog.Error("failed to compile", "rule", rule, slog.Any("error", err))
|
|
|
|
slog.Error("failed to compile", "rule", rule, slog.Any("error", err))
|
|
|
|