correct location for emoji, woops

This commit is contained in:
Moon Man 2020-03-24 01:01:37 +00:00
parent cb5a9662b8
commit f63234ac04
1 changed files with 11 additions and 11 deletions

View File

@ -47,19 +47,19 @@ 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)
extension = Path.extname(Path.basename(emojo_uri.path))
filename = emojo_shortcode <> extension
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]) new_file = Path.join([emoji_dir_path, "priv/static/emoji/stolen", filename])
IO.binwrite(file, remote_emojo.body)
File.close(file) {:ok, file} = File.open(new_file, [:write])
Logger.debug("SAVED EMOJO") IO.binwrite(file, remote_emojo.body)
new_file File.close(file)
end Logger.debug("SAVED EMOJO")
new_file
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}")