mirror of
https://github.com/hacdias/webdav.git
synced 2026-09-25 12:41:54 +08:00
fix: error if rule has no regex or path
This commit is contained in:
@@ -16,6 +16,10 @@ type Rule struct {
|
||||
}
|
||||
|
||||
func (r *Rule) Validate() error {
|
||||
if r.Regex == nil && r.Path == "" {
|
||||
return errors.New("invalid rule: must either define a path of a regex")
|
||||
}
|
||||
|
||||
if r.Regex != nil && r.Path != "" {
|
||||
return errors.New("invalid rule: cannot define both regex and path")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user