diff options
author | Ekaterina Vaartis <vaartis@cock.li> | 2019-08-15 11:46:03 +0300 |
---|---|---|
committer | Ekaterina Vaartis <vaartis@cock.li> | 2019-09-19 00:16:33 +0300 |
commit | b78973d27f0c9225104914c79cf93bf3589fe7cc (patch) | |
tree | dd587d1e1465996b98a54a8177c519655072dff2 | |
parent | 2a94eca096f67a908410ffdd82f5bace8a3df88c (diff) | |
download | pleroma-b78973d27f0c9225104914c79cf93bf3589fe7cc.tar.gz |
fallback can't have pack.json, reflect that in code
having pacj.json and sha256 in a fallback pack would cause a circular dependency of itself
-rw-r--r-- | lib/pleroma/web/emoji_api/emoji_api_controller.ex | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/pleroma/web/emoji_api/emoji_api_controller.ex b/lib/pleroma/web/emoji_api/emoji_api_controller.ex index aedc70372..3b9eab8b8 100644 --- a/lib/pleroma/web/emoji_api/emoji_api_controller.ex +++ b/lib/pleroma/web/emoji_api/emoji_api_controller.ex @@ -184,19 +184,19 @@ keeping it in cache for #{div(cache_ms, 1000)}s") pack_dir = Path.join(@emoji_dir_path, local_name) File.mkdir_p!(pack_dir) + # Fallback cannot contain a pack.json file files = - ['pack.json'] ++ + unless(pinfo[:fallback], do: ['pack.json'], else: []) ++ (pfiles |> Enum.map(fn {_, path} -> to_charlist(path) end)) {:ok, _} = :zip.unzip(emoji_archive, cwd: to_charlist(pack_dir), file_list: files) - # Fallback URL might not contain a pack.json file. Put on we have if there's none + # Fallback can't contain a pack.json file, since that would cause the fallback-src-sha256 + # in it to depend on itself if pinfo[:fallback] do pack_file_path = Path.join(pack_dir, "pack.json") - unless File.exists?(pack_file_path) do - File.write!(pack_file_path, Jason.encode!(full_pack)) - end + File.write!(pack_file_path, Jason.encode!(full_pack)) end conn |> text("ok") |