|
|
@@ -189,6 +189,11 @@ param_path_id() ->
|
|
|
%% Rules API
|
|
|
%%------------------------------------------------------------------------------
|
|
|
|
|
|
+%% To get around the hocon bug, we replace crlf with spaces
|
|
|
+replace_sql_clrf(#{ <<"sql">> := SQL } = Params) ->
|
|
|
+ NewSQL = re:replace(SQL, "[\r\n]", " ", [{return, binary}, global]),
|
|
|
+ Params#{<<"sql">> => NewSQL}.
|
|
|
+
|
|
|
'/rule_events'(get, _Params) ->
|
|
|
{200, emqx_rule_events:event_info()}.
|
|
|
|
|
|
@@ -201,7 +206,7 @@ param_path_id() ->
|
|
|
<<>> ->
|
|
|
{400, #{code => 'BAD_REQUEST', message => <<"empty rule id is not allowed">>}};
|
|
|
Id ->
|
|
|
- Params = filter_out_request_body(Params0),
|
|
|
+ Params = filter_out_request_body(replace_sql_clrf(Params0)),
|
|
|
ConfPath = emqx_rule_engine:config_key_path() ++ [Id],
|
|
|
case emqx_rule_engine:get_rule(Id) of
|
|
|
{ok, _Rule} ->
|