forked from AkkomaGang/akkoma
Change :sha to :checksum
This commit is contained in:
parent
7c784128fd
commit
3971bf9c5f
1 changed files with 2 additions and 2 deletions
|
@ -183,7 +183,7 @@ def download_from(conn, %{"instance_address" => address, "pack_name" => name} =
|
||||||
|
|
||||||
with {:ok, %{sha: sha, uri: uri} = pinfo} <- pack_info_res,
|
with {:ok, %{sha: sha, uri: uri} = pinfo} <- pack_info_res,
|
||||||
%{body: emoji_archive} <- Tesla.get!(uri),
|
%{body: emoji_archive} <- Tesla.get!(uri),
|
||||||
{_, true} <- {:sha, Base.decode16!(sha) == :crypto.hash(:sha256, emoji_archive)} do
|
{_, true} <- {:checksum, Base.decode16!(sha) == :crypto.hash(:sha256, emoji_archive)} do
|
||||||
local_name = data["as"] || name
|
local_name = data["as"] || name
|
||||||
pack_dir = Path.join(@emoji_dir_path, local_name)
|
pack_dir = Path.join(@emoji_dir_path, local_name)
|
||||||
File.mkdir_p!(pack_dir)
|
File.mkdir_p!(pack_dir)
|
||||||
|
@ -207,7 +207,7 @@ def download_from(conn, %{"instance_address" => address, "pack_name" => name} =
|
||||||
{:error, e} ->
|
{:error, e} ->
|
||||||
conn |> put_status(:internal_server_error) |> json(%{error: e})
|
conn |> put_status(:internal_server_error) |> json(%{error: e})
|
||||||
|
|
||||||
{:sha, _} ->
|
{:checksum, _} ->
|
||||||
conn
|
conn
|
||||||
|> put_status(:internal_server_error)
|
|> put_status(:internal_server_error)
|
||||||
|> json(%{error: "SHA256 for the pack doesn't match the one sent by the server"})
|
|> json(%{error: "SHA256 for the pack doesn't match the one sent by the server"})
|
||||||
|
|
Loading…
Reference in a new issue