mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 02:33:14 -04:00
- compliance with metadata contract. If metadata value is empty, ignore rewrite - like if metadata does not exist. (#1953)
This commit is contained in:
committed by
Paul Greenberg
parent
7745462430
commit
b3a92f1622
@@ -203,7 +203,10 @@ func (rule *edns0VariableRule) ruleData(ctx context.Context, state request.Reque
|
||||
|
||||
fetcher := metadata.ValueFunc(ctx, rule.variable[1:len(rule.variable)-1])
|
||||
if fetcher != nil {
|
||||
return []byte(fetcher()), nil
|
||||
value := fetcher()
|
||||
if len(value) > 0 {
|
||||
return []byte(value), nil
|
||||
}
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("unable to extract data for variable %s", rule.variable)
|
||||
|
||||
Reference in New Issue
Block a user