mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
ext_mod: Handle correctly when COMMIT.json not found
This commit is contained in:
parent
00e6b0c97c
commit
72944d895b
@ -805,10 +805,11 @@ get_commit_details2(Path) ->
|
||||
{ok, Body} ->
|
||||
parse_details(Body);
|
||||
_ ->
|
||||
#{sha => <<"1234567890">>,
|
||||
#{sha => unknown_sha,
|
||||
date => <<>>,
|
||||
message => <<>>,
|
||||
html => <<>>,
|
||||
author_name => <<>>,
|
||||
commit_html_url => <<>>}
|
||||
end.
|
||||
|
||||
@ -891,8 +892,10 @@ get_installed_module_el({ModAtom, Attrs}, Lang) ->
|
||||
Summary = list_to_binary(get_module_summary(Attrs)),
|
||||
Author = list_to_binary(get_module_author(Attrs)),
|
||||
{_, FromPath} = lists:keyfind(path, 1, Attrs),
|
||||
{ok, FromFile} = find_commit_json_path(FromPath),
|
||||
|
||||
FromFile = case find_commit_json_path(FromPath) of
|
||||
{ok, FF} -> FF;
|
||||
{error, _} -> "dummypath"
|
||||
end,
|
||||
#{sha := CommitSha,
|
||||
date := CommitDate,
|
||||
message := CommitMessage,
|
||||
@ -925,7 +928,7 @@ get_installed_module_el({ModAtom, Attrs}, Lang) ->
|
||||
Started =
|
||||
case gen_mod:is_loaded(hd(ejabberd_option:hosts()), ModAtom) of
|
||||
false ->
|
||||
[?C(<<" - ">>)];
|
||||
[?C(<<" ">>)];
|
||||
true ->
|
||||
[]
|
||||
end,
|
||||
@ -942,8 +945,8 @@ get_installed_module_el({ModAtom, Attrs}, Lang) ->
|
||||
?XE(<<"td">>,
|
||||
[?INPUTTD(<<"checkbox">>, <<"selected_uninstall">>, Mod),
|
||||
?C(<<" ">>),
|
||||
?AXC(CommitHtmlUrl, [TitleEl], binary:part(CommitSha, {0, 8})),
|
||||
?C(<<" ">>)]
|
||||
get_commit_link(CommitHtmlUrl, TitleEl, CommitSha),
|
||||
?C(<<" - ">>)]
|
||||
++ Started
|
||||
++ Status)
|
||||
| UpgradeEls]).
|
||||
@ -1006,6 +1009,11 @@ make_home_title_el(Summary, Author) ->
|
||||
LinkTitle = <<Summary/binary, "\n", Author/binary>>,
|
||||
{<<"title">>, LinkTitle}.
|
||||
|
||||
get_commit_link(_CommitHtmlUrl, _TitleErl, unknown_sha) ->
|
||||
?C(<<"Please Update Specs">>);
|
||||
get_commit_link(CommitHtmlUrl, TitleEl, CommitSha) ->
|
||||
?AXC(CommitHtmlUrl, [TitleEl], binary:part(CommitSha, {0, 8})).
|
||||
|
||||
get_content(Node, Query, Lang) ->
|
||||
Instruct = translate:translate(Lang, ?T("Type a command in a textbox and click Execute.")),
|
||||
{{_CommandCtl}, _Res} =
|
||||
@ -1034,7 +1042,7 @@ get_content(Node, Query, Lang) ->
|
||||
?XE(<<"tr">>,
|
||||
[?XE(<<"td">>, [?AC(Html, Dirname)]),
|
||||
?XE(<<"td">>,
|
||||
[?AXC(CommitHtmlUrl, [TitleEl], binary:part(CommitSha, {0, 8}))]
|
||||
[get_commit_link(CommitHtmlUrl, TitleEl, CommitSha)]
|
||||
),
|
||||
?XE(<<"td">>, [?C(CommitMessage)])
|
||||
])
|
||||
|
Loading…
Reference in New Issue
Block a user