فهرست منبع

Merge pull request #6399 from tigercl/fix/webhook-path

fix(webhook): fix the issue that the path field does not support rule engine variables
tigercl 4 سال پیش
والد
کامیت
a92712e429
1فایلهای تغییر یافته به همراه6 افزوده شده و 9 حذف شده
  1. 6 9
      apps/emqx_web_hook/src/emqx_web_hook_actions.erl

+ 6 - 9
apps/emqx_web_hook/src/emqx_web_hook_actions.erl

@@ -311,15 +311,12 @@ ensure_content_type_header(Headers, _Method) ->
 
 
 merge_path(CommonPath, <<>>) ->
 merge_path(CommonPath, <<>>) ->
     l2b(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),
-            <<Path2/binary, "?", Query/binary>>;
-        {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(GET) when GET == <<"GET">>; GET == <<"get">> -> get;
 method(POST) when POST == <<"POST">>; POST == <<"post">> -> post;
 method(POST) when POST == <<"POST">>; POST == <<"post">> -> post;