shreemaan-abhishek commented on code in PR #10485:
URL: https://github.com/apache/apisix/pull/10485#discussion_r1392252562


##########
apisix/core/utils.lua:
##########
@@ -292,11 +292,16 @@ local resolve_var
 do
     local _ctx
     local n_resolved
-    local pat = [[(?<!\\)\$\{?(\w+)\}?]]
+    local pat = [[(?<!\\)\$(\{(\w+)\}|(\w+))]]
     local _escaper
 
     local function resolve(m)
-        local v = _ctx[m[1]]
+        local i = 1
+        -- if first capture's first char is "{" evaluate the second capture
+        if m[1]:byte(1) == 123 then
+            i = 2
+        end
+        local v = _ctx[m[i]]

Review Comment:
   this was to fix other test case failures. For example when var = `${alpha}`, 
m[1] = {alpha} and m[2] = alpha. Only m[2] can be evaluated no m[1].



-- 
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]

Reply via email to