events: sanitize enums (#5610)
when importing a flow and returning logs, sometimes an enum might be included which is currently not sanitized and hence causes an exception Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
c3398004ff
commit
ff1510dedc
|
@ -2,6 +2,7 @@
|
|||
import re
|
||||
from copy import copy
|
||||
from dataclasses import asdict, is_dataclass
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from types import GeneratorType
|
||||
from typing import Any, Optional
|
||||
|
@ -126,6 +127,8 @@ def sanitize_item(value: Any) -> Any:
|
|||
return str(value)
|
||||
if isinstance(value, YAMLTag):
|
||||
return str(value)
|
||||
if isinstance(value, Enum):
|
||||
return value.value
|
||||
if isinstance(value, type):
|
||||
return {
|
||||
"type": value.__name__,
|
||||
|
|
Reference in New Issue