From 83981e7c878fd6228c0a7456c11f280c01569e74 Mon Sep 17 00:00:00 2001 From: zhouzb Date: Wed, 8 Dec 2021 11:27:58 +0800 Subject: [PATCH] fix(webhook): fix the issue that the path field does not support rule engine variables --- apps/emqx_web_hook/src/emqx_web_hook_actions.erl | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/apps/emqx_web_hook/src/emqx_web_hook_actions.erl b/apps/emqx_web_hook/src/emqx_web_hook_actions.erl index 68e3e85d4..dd203a19e 100644 --- a/apps/emqx_web_hook/src/emqx_web_hook_actions.erl +++ b/apps/emqx_web_hook/src/emqx_web_hook_actions.erl @@ -311,15 +311,12 @@ ensure_content_type_header(Headers, _Method) -> merge_path(CommonPath, <<>>) -> l2b(CommonPath); -merge_path(CommonPath, Path0) -> - case emqx_http_lib:uri_parse(Path0) of - {ok, #{path := Path1, 'query' := Query0}} -> - Path2 = l2b(filename:join(CommonPath, Path1)), - Query = l2b(Query0), - <>; - {ok, #{path := Path1}} -> - l2b(filename:join(CommonPath, Path1)) - end. +merge_path(CommonPath, Path) -> + Path1 = case Path of + <<"/", Path0/binary>> -> Path0; + _ -> Path + end, + l2b(filename:join(CommonPath, Path1)). method(GET) when GET == <<"GET">>; GET == <<"get">> -> get; method(POST) when POST == <<"POST">>; POST == <<"post">> -> post;