Skip to content

Commit 19ab559

Browse files
committed
Escape atoms as lists and binaries are.
1 parent 08e35ea commit 19ab559

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/rabbit_control.erl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ format_info_item(Key, Items) ->
338338
Value when is_binary(Value) ->
339339
escape(Value);
340340
Value when is_atom(Value) ->
341-
io_lib:format("~s", [Value]);
341+
escape(atom_to_list(Value));
342342
Value ->
343343
io_lib:format("~w", [Value])
344344
end.
@@ -365,7 +365,9 @@ rpc_call(Node, Mod, Fun, Args) ->
365365
%% form part of UTF-8 strings.
366366

367367
escape(Bin) when binary(Bin) ->
368-
escape_char(lists:reverse(binary_to_list(Bin)), []).
368+
escape(binary_to_list(Bin));
369+
escape(L) when is_list(L) ->
370+
escape_char(lists:reverse(L), []).
369371

370372
escape_char([$\\ | T], Acc) ->
371373
escape_char(T, [$\\, $\\ | Acc]);

0 commit comments

Comments
 (0)