bytelazy commented on code in PR #12649:
URL: https://github.com/apache/apisix/pull/12649#discussion_r2594688019
##########
apisix/plugins/grpc-transcode/response.lua:
##########
@@ -23,6 +23,47 @@ local string = string
local ngx_decode_base64 = ngx.decode_base64
local ipairs = ipairs
local pcall = pcall
+local type = type
+local pairs = pairs
+local setmetatable = setmetatable
+
+-- Protobuf repeated field label value
+local PROTOBUF_REPEATED_LABEL = 3
+local repeated_label = PROTOBUF_REPEATED_LABEL
+
+local function fetch_proto_array_names(proto_obj)
+ local names = {}
+ if type(proto_obj) == "table" then
Review Comment:
fetch_proto_array_names always returns a table so that its callers can
safely iterate with pairs(sub_names). Returning nil for the base case would
trigger a runtime error when pairs(nil) is evaluated, and it would not change
correctness because the existing code already skips non-table values
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]