Set null list when or list is nil in query (#14941)

Set null list when or list is nil in query

Signed-off-by: Wenkai Yin <yinw@vmware.com>
This commit is contained in:
Wenkai Yin(尹文开) 2021-05-24 16:22:39 +08:00 committed by GitHub
parent 306e519dbe
commit 544fa806fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,7 +156,9 @@ func setFilters(ctx context.Context, qs orm.QuerySeter, query *q.Query, meta *me
}
// or list
if ol, ok := value.(*q.OrList); ok {
if len(ol.Values) > 0 {
if ol == nil || len(ol.Values) == 0 {
qs = qs.Filter(key+"__in", nil)
} else {
qs = qs.Filter(key+"__in", ol.Values...)
}
continue