Update the pack fallback-src sha generation condition
authorEkaterina Vaartis <vaartis@cock.li>
Fri, 16 Aug 2019 10:30:14 +0000 (13:30 +0300)
committerEkaterina Vaartis <vaartis@cock.li>
Wed, 18 Sep 2019 21:16:33 +0000 (00:16 +0300)
The old one would not regenerate sha when fallback src changed

lib/pleroma/web/emoji_api/emoji_api_controller.ex

index 4096ccbedd06c43ae589a4536bb42778aa512284..4873129c4d844ba4802ea409e043656d97c27063 100644 (file)
@@ -229,8 +229,13 @@ keeping it in cache for #{div(cache_ms, 1000)}s")
 
     full_pack = Jason.decode!(File.read!(pack_file_p))
 
+    # The new fallback-src is in the new data and it's not the same as it was in the old data
+    should_update_fb_sha =
+      not is_nil(new_data["fallback-src"]) and
+        new_data["fallback-src"] != full_pack["pack"]["fallback-src"]
+
     new_data =
-      if not is_nil(new_data["fallback-src"]) and is_nil(new_data["fallback-src-sha256"]) do
+      if should_update_fb_sha do
         pack_arch = Tesla.get!(new_data["fallback-src"]).body
 
         {:ok, flist} = :zip.unzip(pack_arch, [:memory])