fix for FlexibleStringSlice cause picoclaw start crash issue (#2078)
This commit is contained in:
parent
25ce52715d
commit
0c9e4f0658
1 changed files with 7 additions and 1 deletions
|
|
@ -53,8 +53,14 @@ func (f *FlexibleStringSlice) UnmarshalJSON(data []byte) error {
|
||||||
// Try []interface{} to handle mixed types
|
// Try []interface{} to handle mixed types
|
||||||
var raw []any
|
var raw []any
|
||||||
if err := json.Unmarshal(data, &raw); err != nil {
|
if err := json.Unmarshal(data, &raw); err != nil {
|
||||||
|
var s string
|
||||||
|
// fail over to compatible to old format string
|
||||||
|
if err = json.Unmarshal(data, &s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
*f = []string{s}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
result := make([]string, 0, len(raw))
|
result := make([]string, 0, len(raw))
|
||||||
for _, v := range raw {
|
for _, v := range raw {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue