mirror of
https://github.com/goauthentik/authentik.git
synced 2026-06-17 19:09:11 +03:00
providers/radius: fix panic in log due to type (#22965)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package radius
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"beryju.io/radius-eap/protocol"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -38,9 +41,28 @@ func (i *iter) At() (k string, v any) {
|
||||
|
||||
if i.i+1 == len(i.f) {
|
||||
// Non even number of elements, add empty string.
|
||||
return i.f[i.i].(string), ""
|
||||
return toString(i.f[i.i]), ""
|
||||
}
|
||||
return toString(i.f[i.i]), i.f[i.i+1]
|
||||
}
|
||||
|
||||
func toString(v any) string {
|
||||
switch t := v.(type) {
|
||||
case string:
|
||||
return t
|
||||
case *string:
|
||||
return *t
|
||||
case bool:
|
||||
return strconv.FormatBool(t)
|
||||
case float32:
|
||||
return strconv.FormatFloat(float64(t), 'f', -1, 64)
|
||||
case float64:
|
||||
return strconv.FormatFloat(t, 'f', -1, 64)
|
||||
case int:
|
||||
return strconv.FormatInt(int64(t), 10)
|
||||
default:
|
||||
return fmt.Sprintf("%s", t)
|
||||
}
|
||||
return i.f[i.i].(string), i.f[i.i+1]
|
||||
}
|
||||
|
||||
type logrusAdapter struct {
|
||||
|
||||
Reference in New Issue
Block a user