Skip to content

Commit 3c2796f

Browse files
committed
fix: escape special character '-' to be compatible with pcre2
1 parent cb909b1 commit 3c2796f

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

gateway/src/apicast/mapping_rule.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ local function regexpify(pattern)
4242

4343
pattern = re_gsub(pattern, [[\?.*]], '', 'oj')
4444
-- dollar sign is escaped by another $, see https://github.com/openresty/lua-nginx-module#ngxresub
45-
pattern = re_gsub(pattern, [[\{.+?\}]], [[([\w-.~%!$$&'()*+,;=@:]+)]], 'oj')
45+
pattern = re_gsub(pattern, [[\{.+?\}]], [[([\w\-.~%!$$&'()*+,;=@:]+)]], 'oj')
4646
pattern = re_gsub(pattern, [[\.]], [[\.]], 'oj')
4747
return pattern
4848
end

gateway/src/apicast/policy/rewrite_url_captures/named_args_matcher.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ local function transform_rule_to_regex(match_rule)
5353
return re_gsub(
5454
match_rule,
5555
[[\{.+?\}]],
56-
[[([\w-.~%!$$&'()*+,;=@:]+)]], -- Same as in the MappingRule module
56+
[[([\w\-.~%!$$&'()*+,;=@:]+)]], -- Same as in the MappingRule module
5757
'oj'
5858
)
5959
end

0 commit comments

Comments
 (0)