mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
fix for FlexibleStringSlice cause picoclaw start crash issue (#2078)
This commit is contained in:
@@ -53,7 +53,13 @@ func (f *FlexibleStringSlice) UnmarshalJSON(data []byte) error {
|
||||
// Try []interface{} to handle mixed types
|
||||
var raw []any
|
||||
if err := json.Unmarshal(data, &raw); err != nil {
|
||||
return err
|
||||
var s string
|
||||
// fail over to compatible to old format string
|
||||
if err = json.Unmarshal(data, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
*f = []string{s}
|
||||
return nil
|
||||
}
|
||||
|
||||
result := make([]string, 0, len(raw))
|
||||
|
||||
Reference in New Issue
Block a user