Преглед изворни кода

Merge pull request #13358 from lafirest/fix/authn_reason

fix(events): fixed the reason format of the `authn_complete_event`
lafirest пре 1 година
родитељ
комит
bd075caf56
2 измењених фајлова са 7 додато и 1 уклоњено
  1. 6 1
      apps/emqx_rule_engine/src/emqx_rule_events.erl
  2. 1 0
      changes/ce/fix-13358.en.md

+ 6 - 1
apps/emqx_rule_engine/src/emqx_rule_events.erl

@@ -1290,7 +1290,12 @@ reason(_) -> internal_error.
 force_to_bin(Bin) when is_binary(Bin) ->
     Bin;
 force_to_bin(Term) ->
-    emqx_utils_conv:bin(io_lib:format("~p", [Term])).
+    try
+        emqx_utils_conv:bin(Term)
+    catch
+        _:_ ->
+            emqx_utils_conv:bin(lists:flatten(io_lib:format("~p", [Term])))
+    end.
 
 ntoa(undefined) ->
     undefined;

+ 1 - 0
changes/ce/fix-13358.en.md

@@ -0,0 +1 @@
+Fixed that the `reason` in the `authn_complete_event` event was not displayed correctly.