mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 02:02:43 +00:00
Fix potential panic in audit during header formatting (#22694)
This commit is contained in:
@@ -5,6 +5,7 @@ package audit
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -150,9 +151,13 @@ func WithHMACAccessor(h bool) Option {
|
||||
}
|
||||
|
||||
// WithHeaderFormatter provides an Option to supply a HeaderFormatter.
|
||||
// If the HeaderFormatter interface supplied is nil (type or value), the option will not be applied.
|
||||
func WithHeaderFormatter(f HeaderFormatter) Option {
|
||||
return func(o *options) error {
|
||||
o.withHeaderFormatter = f
|
||||
if f != nil && !reflect.ValueOf(f).IsNil() {
|
||||
o.withHeaderFormatter = f
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user