Browse Source

fix(webhook): convert atom to binary to avoid jiffy encoding failure

JianBo He 4 years ago
parent
commit
1d241bc39c
1 changed files with 3 additions and 1 deletions
  1. 3 1
      apps/emqx_web_hook/src/emqx_web_hook.erl

+ 3 - 1
apps/emqx_web_hook/src/emqx_web_hook.erl

@@ -378,8 +378,10 @@ encode_payload(Payload, base62) -> emqx_base62:encode(Payload);
 encode_payload(Payload, base64) -> base64:encode(Payload);
 encode_payload(Payload, plain) -> Payload.
 
-stringfy(Term) when is_atom(Term); is_binary(Term) ->
+stringfy(Term) when is_binary(Term) ->
     Term;
+stringfy(Term) when is_atom(Term) ->
+    atom_to_binary(Term, utf8);
 stringfy(Term) ->
     unicode:characters_to_binary((io_lib:format("~0p", [Term]))).