commit: 8d0b29d7183f11c05f695d0c3cf4b4ec1d2d2d67
parent 26ac875bc8f1853cb2718c57292fbd336584359e
Author: Ekaterina Vaartis <vaartis@kotobank.ch>
Date: Thu, 7 Aug 2025 11:22:51 +0300
Only calculate SHA when there's no pack json
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/pleroma/emoji/pack.ex b/lib/pleroma/emoji/pack.ex
@@ -252,9 +252,6 @@ defmodule Pleroma.Emoji.Pack do
{_, {:ok, _}} <-
{"Could not unzip pack",
: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"])
# Make a json if it does not exist
if not File.exists?(pack_json_path) do
@@ -265,6 +262,9 @@ defmodule Pleroma.Emoji.Pack do
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: %{
license: Map.get(opts, :license, ""),