Skip to content

Commit dec1175

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 dec1175

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

deps/rabbitmq_management/src/rabbit_mgmt_wm_overview.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ web_contexts(ReqData) ->
126126
["description", "port", "node"]).
127127

128128
fmt_contexts(Node) ->
129-
[fmt_context(Node, C) || C <- pget(contexts, Node, [])].
129+
[fmt_context(Node, C) || C <- pget(contexts, Node, [])].
130130

131131
fmt_context(Node, C) ->
132-
rabbit_mgmt_format:web_context([{node, pget(name, Node)} | C]).
132+
rabbit_mgmt_format:web_context([{node, pget(name, Node)} | C]).
133133

134134
erlang_version() -> list_to_binary(rabbit_misc:otp_release()).
135135

deps/rabbitmq_management_agent/src/rabbit_mgmt_format.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,16 +318,16 @@ 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)])),
330-
format_socket_opts(Tail, [{cacerts, CertsKeysMsg} | Acc]);
330+
format_socket_opts(Tail, [{certs_keys, CertsKeysMsg} | Acc]);
331331
%% we do not report SNI host details in the UI,
332332
%% so skip this option and avoid some recursive formatting
333333
%% complexity

0 commit comments

Comments
 (0)