Skip to content

Commit b5e93e5

Browse files
committed
Follow-up fix to 14655
Follow-up to rabbitmq#14655 The code to format `cacerts` and `certs_keys` needs to check if the incoming value is a list or map, and skip it if not. This is the same pattern as used in a later function head: ``` format_socket_opts([Head = {Name, Value} | Tail], Acc) when is_list(Value) -> ``` It ensures that the code won't be called again on an already-formatted value.
1 parent 5a3b62b commit b5e93e5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

deps/rabbitmq_management_agent/src/rabbit_mgmt_format.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,13 +318,13 @@ format_socket_opts([{user_lookup_fun, _Value} | Tail], Acc) ->
318318
format_socket_opts([{sni_fun, _Value} | Tail], Acc) ->
319319
format_socket_opts(Tail, Acc);
320320
%% https://www.erlang.org/doc/apps/ssl/ssl.html#t:server_option_cert/0
321-
format_socket_opts([{cacerts, Cacerts} | Tail], Acc) ->
321+
format_socket_opts([{cacerts, Cacerts} | Tail], Acc) when is_list(Cacerts) ->
322322
CacertsMsg = rabbit_data_coercion:to_utf8_binary(
323323
io_lib:format("(~b cacerts entries)", [length(Cacerts)])),
324324
format_socket_opts(Tail, [{cacerts, CacertsMsg} | Acc]);
325325
%% https://www.erlang.org/doc/apps/ssl/ssl.html#t:common_option_cert/0
326326
%% https://www.erlang.org/doc/apps/ssl/ssl.html#t:cert_key_conf/0
327-
format_socket_opts([{certs_keys, CertsKeys} | Tail], Acc) ->
327+
format_socket_opts([{certs_keys, CertsKeys} | Tail], Acc) when is_map(CertsKeys) ->
328328
CertsKeysMsg = rabbit_data_coercion:to_utf8_binary(
329329
io_lib:format("(~b certs_keys entries)", [length(CertsKeys)])),
330330
format_socket_opts(Tail, [{cacerts, CertsKeysMsg} | Acc]);

0 commit comments

Comments
 (0)