bzp2010 commented on code in PR #12291: URL: https://github.com/apache/apisix/pull/12291#discussion_r2135484297
########## apisix/admin/v3_adapter.lua: ########## @@ -120,11 +122,44 @@ local function pagination(body, args) end -local function filter(body, args) - if not args.name and not args.label and not args.uri then - return +local function _filter(item, args, resource) + if not args.filter then + return true + end + + local filters, err = ngx.decode_args(args.filter or "", 100) + if not filters then + log.error("failed to decode filter args: ", err) + return false + end + + for key, value in pairs(filters) do + if not resource.list_filter_fields[key] then + log.warn("filter field '", key, "' is not supported by resource: ", resource.name) + goto CONTINUE + end + + if not item[key] then + return false + end + + if type(value) == "table" then + value = value[#value] -- get the last value in the table + end + + local matched = re_find(item[key], value, "jo") Review Comment: Moved to exact match -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org