File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -656,7 +656,7 @@ local function fetch_pat(path)
656656 if first_byte == string.byte (" :" ) then
657657 table.insert (names , res [i ]:sub (2 ))
658658 -- See https://www.rfc-editor.org/rfc/rfc1738.txt BNF for specific URL schemes
659- res [i ] = [=[ ([\w\-_;:@&=!',\%\$\.\+\*\(\) ]+)]=]
659+ res [i ] = [=[ ([^\/ ]+)]=]
660660
661661 elseif first_byte == string.byte (" *" ) then
662662 local name = res [i ]:sub (2 )
Original file line number Diff line number Diff line change @@ -473,3 +473,32 @@ GET /t
473473match meta: long
474474match meta: short
475475match meta: medium
476+
477+
478+
479+ === TEST 14: special characters in parameter should match
480+ --- config
481+ location /t {
482+ content_by_lua_block {
483+ local json = require("toolkit.json")
484+ local radix = require("resty.radixtree")
485+ local rx = radix.new({
486+ {
487+ paths = {"/name/:name/id"},
488+ metadata = "metadata /name",
489+ },
490+ })
491+
492+ local opts = {matched = {}}
493+ local meta = rx:match("/name/json%20space/id", opts)
494+ ngx.say("match meta: ", meta)
495+ ngx.say("matched: ", json.encode(opts.matched))
496+ }
497+ }
498+ --- request
499+ GET /t
500+ --- no_error_log
501+ [error]
502+ --- response_body
503+ match meta: metadata /name
504+ matched: {"_path":"/name/:name/id","name":"json%20space"}
You can’t perform that action at this time.
0 commit comments