correct location for emoji, woops
This commit is contained in:
parent
cb5a9662b8
commit
f63234ac04
|
@ -47,12 +47,13 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy do
|
||||||
remote_emojo = HTTPoison.get!(emojo_url)
|
remote_emojo = HTTPoison.get!(emojo_url)
|
||||||
|
|
||||||
if remote_emojo.status_code == 200 do
|
if remote_emojo.status_code == 200 do
|
||||||
with {:ok, current_dir} <- File.cwd() do
|
emoji_dir_path = Path.join(Config.get!([:instance, :static_dir]), "emoji/stolen")
|
||||||
|
|
||||||
emojo_uri = URI.parse(emojo_url)
|
emojo_uri = URI.parse(emojo_url)
|
||||||
extension = Path.extname(Path.basename(emojo_uri.path))
|
extension = Path.extname(Path.basename(emojo_uri.path))
|
||||||
filename = emojo_shortcode <> extension
|
filename = emojo_shortcode <> extension
|
||||||
|
|
||||||
new_file = Path.join([current_dir, "priv/static/emoji/stolen", filename])
|
new_file = Path.join([emoji_dir_path, "priv/static/emoji/stolen", filename])
|
||||||
|
|
||||||
{:ok, file} = File.open(new_file, [:write])
|
{:ok, file} = File.open(new_file, [:write])
|
||||||
IO.binwrite(file, remote_emojo.body)
|
IO.binwrite(file, remote_emojo.body)
|
||||||
|
@ -60,7 +61,6 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy do
|
||||||
Logger.debug("SAVED EMOJO")
|
Logger.debug("SAVED EMOJO")
|
||||||
new_file
|
new_file
|
||||||
end
|
end
|
||||||
end
|
|
||||||
rescue
|
rescue
|
||||||
e in RuntimeError -> Logger.error("FAILED TO QUERY REMOTE EMOJO #{emojo_url} #{e}")
|
e in RuntimeError -> Logger.error("FAILED TO QUERY REMOTE EMOJO #{emojo_url} #{e}")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue