Handle empty orlist in orm query (#11270)

Fixes #11267
When caller parse an empty orlist to orm lib, it will parse the empty vaule to beego orm.
But beego will panic if the query string is empty.

Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
Wang Yan 2020-03-26 11:23:20 +08:00 committed by GitHub
parent e8ca51a18f
commit da8902da53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -66,7 +66,7 @@ func QuerySetter(ctx context.Context, model interface{}, query *q.Query, ignored
// or list
ol, ok := v.(*q.OrList)
if ok {
if ok && len(ol.Values) > 0 {
qs = qs.Filter(k+"__in", ol.Values...)
continue
}