Merge pull request #14277 from lukebakken/lukebakken/fix-popup-text-formatting
Trigger a 4.2.x alpha release build / trigger_alpha_build (push) Waiting to run
Details
Test (make) / Build and Xref (1.18, 26) (push) Waiting to run
Details
Test (make) / Build and Xref (1.18, 27) (push) Waiting to run
Details
Test (make) / Build and Xref (1.18, 28) (push) Waiting to run
Details
Test (make) / Test (1.18, 28, khepri) (push) Waiting to run
Details
Test (make) / Test (1.18, 28, mnesia) (push) Waiting to run
Details
Test (make) / Test mixed clusters (1.18, 28, khepri) (push) Waiting to run
Details
Test (make) / Test mixed clusters (1.18, 28, mnesia) (push) Waiting to run
Details
Test (make) / Type check (1.18, 28) (push) Waiting to run
Details
Test Authentication/Authorization backends via mutiple messaging protocols / selenium (chrome, 1.17.3, 27.3) (push) Has been cancelled
Details
Test Management UI with Selenium / selenium (chrome, 1.17.3, 27.3) (push) Has been cancelled
Details
Test Authentication/Authorization backends via mutiple messaging protocols / summary-selenium (push) Has been cancelled
Details
Trigger a 4.2.x alpha release build / trigger_alpha_build (push) Waiting to run
Details
Test (make) / Build and Xref (1.18, 26) (push) Waiting to run
Details
Test (make) / Build and Xref (1.18, 27) (push) Waiting to run
Details
Test (make) / Build and Xref (1.18, 28) (push) Waiting to run
Details
Test (make) / Test (1.18, 28, khepri) (push) Waiting to run
Details
Test (make) / Test (1.18, 28, mnesia) (push) Waiting to run
Details
Test (make) / Test mixed clusters (1.18, 28, khepri) (push) Waiting to run
Details
Test (make) / Test mixed clusters (1.18, 28, mnesia) (push) Waiting to run
Details
Test (make) / Type check (1.18, 28) (push) Waiting to run
Details
Test Authentication/Authorization backends via mutiple messaging protocols / selenium (chrome, 1.17.3, 27.3) (push) Has been cancelled
Details
Test Management UI with Selenium / selenium (chrome, 1.17.3, 27.3) (push) Has been cancelled
Details
Test Authentication/Authorization backends via mutiple messaging protocols / summary-selenium (push) Has been cancelled
Details
Fix error popup text display
This commit is contained in:
commit
84e0478ff7
|
@ -710,6 +710,8 @@ format({shutdown, _} = Error) ->
|
|||
?LOG_DEBUG("Metadata store is unavailable: ~p", [Error]),
|
||||
rabbit_data_coercion:to_binary(
|
||||
rabbit_misc:format("Metadata store is unavailable. Please try again.", []));
|
||||
format(E) when is_binary(E) ->
|
||||
E;
|
||||
format(E) ->
|
||||
rabbit_data_coercion:to_binary(rabbit_misc:format("~tp", [E])).
|
||||
|
||||
|
@ -733,8 +735,8 @@ add_parameter(VHost, Param, Username) ->
|
|||
case Result of
|
||||
ok -> ok;
|
||||
{error_string, E} ->
|
||||
S = rabbit_misc:format(" (~ts/~ts/~ts)", [VHost, Comp, Key]),
|
||||
exit(rabbit_data_coercion:to_binary(rabbit_misc:escape_html_tags(E ++ S)))
|
||||
S = rabbit_misc:format(" (vhost: \"~ts\" / component: \"~ts\" / key: \"~ts\")", [VHost, Comp, Key]),
|
||||
exit(rabbit_data_coercion:to_utf8_binary(E ++ S))
|
||||
end.
|
||||
|
||||
add_global_parameter(Param, Username) ->
|
||||
|
@ -770,8 +772,8 @@ add_policy(VHost, Param, Username) ->
|
|||
maps:get('apply-to', Param, <<"all">>),
|
||||
Username) of
|
||||
ok -> ok;
|
||||
{error_string, E} -> S = rabbit_misc:format(" (~ts/~ts)", [VHost, Key]),
|
||||
exit(rabbit_data_coercion:to_binary(rabbit_misc:escape_html_tags(E ++ S)))
|
||||
{error_string, E} -> S = rabbit_misc:format(" (vhost: \"~ts\" key: \"~ts\")", [VHost, Key]),
|
||||
exit(rabbit_data_coercion:to_utf8_binary(E ++ S))
|
||||
end.
|
||||
|
||||
-spec add_vhost(map(), rabbit_types:username()) -> ok | no_return().
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
-export([get_parent/0]).
|
||||
-export([store_proc_name/1, store_proc_name/2, get_proc_name/0]).
|
||||
-export([moving_average/4]).
|
||||
-export([escape_html_tags/1, b64decode_or_throw/1]).
|
||||
-export([b64decode_or_throw/1]).
|
||||
-export([get_env/3]).
|
||||
-export([get_channel_operation_timeout/0]).
|
||||
-export([random/1]).
|
||||
|
@ -1182,25 +1182,6 @@ moving_average(Time, HalfLife, Next, Current) ->
|
|||
random(N) ->
|
||||
rand:uniform(N).
|
||||
|
||||
-spec escape_html_tags(string()) -> binary().
|
||||
|
||||
escape_html_tags(S) ->
|
||||
escape_html_tags(rabbit_data_coercion:to_list(S), []).
|
||||
|
||||
|
||||
-spec escape_html_tags(string(), string()) -> binary().
|
||||
|
||||
escape_html_tags([], Acc) ->
|
||||
rabbit_data_coercion:to_binary(lists:reverse(Acc));
|
||||
escape_html_tags("<" ++ Rest, Acc) ->
|
||||
escape_html_tags(Rest, lists:reverse("<", Acc));
|
||||
escape_html_tags(">" ++ Rest, Acc) ->
|
||||
escape_html_tags(Rest, lists:reverse(">", Acc));
|
||||
escape_html_tags("&" ++ Rest, Acc) ->
|
||||
escape_html_tags(Rest, lists:reverse("&", Acc));
|
||||
escape_html_tags([C | Rest], Acc) ->
|
||||
escape_html_tags(Rest, [C | Acc]).
|
||||
|
||||
%% If the server we are talking to has non-standard net_ticktime, and
|
||||
%% our connection lasts a while, we could get disconnected because of
|
||||
%% a timeout unless we set our ticktime to be the same. So let's do
|
||||
|
|
|
@ -877,8 +877,7 @@ with_vhost_and_props(Fun, ReqData, Context) ->
|
|||
bad_request(Error, ReqData1, Context)
|
||||
end;
|
||||
{error, Reason} ->
|
||||
bad_request(rabbit_mgmt_format:escape_html_tags(Reason),
|
||||
ReqData1, Context)
|
||||
bad_request(Reason, ReqData1, Context)
|
||||
end
|
||||
end.
|
||||
|
||||
|
|
|
@ -48,8 +48,7 @@ to_json(ReqData, Context) ->
|
|||
{badrpc, Err} ->
|
||||
failure(rabbit_mgmt_format:print("~tp", Err), ReqData, Context);
|
||||
{error_string, Err} ->
|
||||
S = rabbit_mgmt_format:escape_html_tags(
|
||||
rabbit_data_coercion:to_list(rabbit_mgmt_format:print(Err))),
|
||||
S = rabbit_mgmt_format:print(Err),
|
||||
failure(S, ReqData, Context)
|
||||
end.
|
||||
|
||||
|
|
|
@ -61,10 +61,7 @@ accept_content(ReqData0, Context = #context{user = User}) ->
|
|||
ok ->
|
||||
{true, ReqData, Context};
|
||||
{error_string, Reason} ->
|
||||
S = rabbit_mgmt_format:escape_html_tags(
|
||||
rabbit_data_coercion:to_list(Reason)),
|
||||
rabbit_mgmt_util:bad_request(
|
||||
rabbit_data_coercion:to_binary(S), ReqData, Context)
|
||||
rabbit_mgmt_util:bad_request(Reason, ReqData, Context)
|
||||
end
|
||||
end)
|
||||
end.
|
||||
|
|
|
@ -60,8 +60,7 @@ accept_content(ReqData0, Context = #context{user = #user{username = Username}})
|
|||
ok ->
|
||||
{true, ReqData, Context};
|
||||
{error_string, Reason} ->
|
||||
rabbit_mgmt_util:bad_request(
|
||||
rabbit_mgmt_format:escape_html_tags(Reason), ReqData, Context)
|
||||
rabbit_mgmt_util:bad_request(Reason, ReqData, Context)
|
||||
end
|
||||
end)
|
||||
end.
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
-export([to_amqp_table/1, listener/1, web_context/1, properties/1, basic_properties/1]).
|
||||
-export([record/2, to_basic_properties/1]).
|
||||
-export([addr/1, port/1]).
|
||||
-export([format_nulls/1, escape_html_tags/1]).
|
||||
-export([format_nulls/1]).
|
||||
-export([print/2, print/1]).
|
||||
|
||||
-export([format_queue_stats/1, format_queue_basic_stats/1,
|
||||
|
@ -551,27 +551,6 @@ format_null_item([{_K, _V} | _T] = L) ->
|
|||
format_null_item(Value) ->
|
||||
Value.
|
||||
|
||||
|
||||
-spec escape_html_tags(string()) -> binary().
|
||||
|
||||
escape_html_tags(S) ->
|
||||
escape_html_tags(rabbit_data_coercion:to_list(S), []).
|
||||
|
||||
|
||||
-spec escape_html_tags(string(), string()) -> binary().
|
||||
|
||||
escape_html_tags([], Acc) ->
|
||||
rabbit_data_coercion:to_binary(lists:reverse(Acc));
|
||||
escape_html_tags("<" ++ Rest, Acc) ->
|
||||
escape_html_tags(Rest, lists:reverse("<", Acc));
|
||||
escape_html_tags(">" ++ Rest, Acc) ->
|
||||
escape_html_tags(Rest, lists:reverse(">", Acc));
|
||||
escape_html_tags("&" ++ Rest, Acc) ->
|
||||
escape_html_tags(Rest, lists:reverse("&", Acc));
|
||||
escape_html_tags([C | Rest], Acc) ->
|
||||
escape_html_tags(Rest, [C | Acc]).
|
||||
|
||||
|
||||
-spec clean_consumer_details(proplists:proplist()) -> proplists:proplist().
|
||||
clean_consumer_details(Obj) ->
|
||||
case pget(consumer_details, Obj) of
|
||||
|
|
|
@ -275,8 +275,8 @@ not_authorised(Reason, ReqData, Context) ->
|
|||
|
||||
halt_response(Code, Type, Reason, ReqData, Context) ->
|
||||
ReasonFormatted = format_reason(Reason),
|
||||
Json = #{<<"error">> => Type,
|
||||
<<"reason">> => ReasonFormatted},
|
||||
Json = #{error => Type,
|
||||
reason => ReasonFormatted},
|
||||
ReqData1 = cowboy_req:reply(Code,
|
||||
#{<<"content-type">> => <<"application/json">>},
|
||||
rabbit_json:encode(Json), ReqData),
|
||||
|
@ -288,7 +288,7 @@ not_authenticated(Reason, ReqData, Context, _AuthConfig) ->
|
|||
format_reason(Tuple) when is_tuple(Tuple) ->
|
||||
tuple(Tuple);
|
||||
format_reason(Binary) when is_binary(Binary) ->
|
||||
Binary;
|
||||
unicode:characters_to_binary(Binary);
|
||||
format_reason(Other) ->
|
||||
case is_string(Other) of
|
||||
true -> print("~ts", [Other]);
|
||||
|
|
Loading…
Reference in New Issue