Only calculate SHA when there's no pack json
This commit is contained in:
parent
26ac875bc8
commit
8d0b29d718
1 changed files with 3 additions and 3 deletions
|
|
@ -252,9 +252,6 @@ defmodule Pleroma.Emoji.Pack do
|
||||||
{_, {:ok, _}} <-
|
{_, {:ok, _}} <-
|
||||||
{"Could not unzip pack",
|
{"Could not unzip pack",
|
||||||
:zip.unzip(binary_archive, cwd: String.to_charlist(pack_path))} do
|
:zip.unzip(binary_archive, cwd: String.to_charlist(pack_path))} do
|
||||||
# Get the pack SHA
|
|
||||||
archive_sha = :crypto.hash(:sha256, binary_archive) |> Base.encode16()
|
|
||||||
|
|
||||||
pack_json_path = Path.join([pack_path, "pack.json"])
|
pack_json_path = Path.join([pack_path, "pack.json"])
|
||||||
# Make a json if it does not exist
|
# Make a json if it does not exist
|
||||||
if not File.exists?(pack_json_path) do
|
if not File.exists?(pack_json_path) do
|
||||||
|
|
@ -265,6 +262,9 @@ defmodule Pleroma.Emoji.Pack do
|
||||||
Map.get(opts, :exts, [".png", ".gif", ".jpg"])
|
Map.get(opts, :exts, [".png", ".gif", ".jpg"])
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Calculate the pack SHA. Only needed when there's no pack.json, as it would already include a hash
|
||||||
|
archive_sha = :crypto.hash(:sha256, binary_archive) |> Base.encode16()
|
||||||
|
|
||||||
pack_json = %{
|
pack_json = %{
|
||||||
pack: %{
|
pack: %{
|
||||||
license: Map.get(opts, :license, ""),
|
license: Map.get(opts, :license, ""),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue