mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-25 10:18:59 +02:00
fix(rules): handle empty matcher as unconditional rule
The matcherSignature function now treats empty strings as unconditional rules that match any request, returning "(any)" as the signature instead of rejecting them. This enables proper dead code detection when an unconditional terminating rule shadows later rules. Adds test coverage for detecting dead rules caused by unconditional terminating rules.
This commit is contained in:
@@ -155,7 +155,7 @@ func ruleOnAlwaysTrue(on RuleOn) bool {
|
||||
func matcherSignature(raw string) (string, bool) {
|
||||
raw = strings.TrimSpace(raw)
|
||||
if raw == "" {
|
||||
return "", false
|
||||
return "(any)", true // unconditional rule
|
||||
}
|
||||
|
||||
andParts := splitAnd(raw)
|
||||
|
||||
Reference in New Issue
Block a user