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