Преглед на файлове

fix: cli's args in audit log should be array

zhongwencool преди 2 години
родител
ревизия
482e82f914

+ 1 - 1
apps/emqx_ctl/src/emqx_ctl.app.src

@@ -1,6 +1,6 @@
 {application, emqx_ctl, [
     {description, "Backend for emqx_ctl script"},
-    {vsn, "0.1.4"},
+    {vsn, "0.1.5"},
     {registered, []},
     {mod, {emqx_ctl_app, []}},
     {applications, [

+ 3 - 2
apps/emqx_ctl/src/emqx_ctl.erl

@@ -331,13 +331,14 @@ safe_to_existing_atom(Str) ->
 is_initialized() ->
     ets:info(?CMD_TAB) =/= undefined.
 
-audit_log(Level, From, Log) ->
+audit_log(Level, From, Log = #{args := Args}) ->
     case lookup_command(audit) of
         {error, _} ->
             ignore;
         {ok, {Mod, Fun}} ->
             try
-                apply(Mod, Fun, [Level, From, Log])
+                Log1 = Log#{args => [unicode:characters_to_binary(A) || A <- Args]},
+                apply(Mod, Fun, [Level, From, Log1])
             catch
                 _:Reason:Stacktrace ->
                     ?LOG_ERROR(#{

+ 1 - 1
apps/emqx_dashboard/src/emqx_dashboard.app.src

@@ -2,7 +2,7 @@
 {application, emqx_dashboard, [
     {description, "EMQX Web Dashboard"},
     % strict semver, bump manually!
-    {vsn, "5.0.28"},
+    {vsn, "5.0.29"},
     {modules, []},
     {registered, [emqx_dashboard_sup]},
     {applications, [

+ 1 - 1
apps/emqx_dashboard/src/emqx_dashboard_cli.erl

@@ -70,7 +70,7 @@ admins(_) ->
 unload() ->
     emqx_ctl:unregister_command(admins).
 
-bin(S) -> iolist_to_binary(S).
+bin(S) -> unicode:characters_to_binary(S).
 
 print_error(Reason) when is_binary(Reason) ->
     emqx_ctl:print("Error: ~s~n", [Reason]).