Remove legacy switch from decodeFilters after UI bug #12579 fix (#22510)

legacy switch from decodeFilters

Signed-off-by: Anurag Ojha <aojharaj2004@gmail.com>
This commit is contained in:
Anurag Ojha 2025-10-29 06:28:31 +05:30 committed by GitHub
parent 575aed0698
commit bdee4da625
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,7 +16,6 @@ package policy
import (
"encoding/json"
"strconv"
"time"
beego_orm "github.com/beego/beego/v2/client/orm"
@ -198,24 +197,6 @@ func decodeFilters(filterStr string) ([]*Filter, error) {
if err := json.Unmarshal([]byte(filterStr), &filters); err != nil {
return nil, err
}
// Convert value type
// TODO: remove switch after UI bug #12579 fixed
for _, f := range filters {
if f.Type == FilterTypeVulnerability {
switch f.Value.(type) {
case string:
sev, err := strconv.ParseInt(f.Value.(string), 10, 32)
if err != nil {
return nil, errors.Wrapf(err, "parse filters")
}
f.Value = (int)(sev)
case float64:
f.Value = (int)(f.Value.(float64))
}
}
}
return filters, nil
}