fix path bug, fix config bug
This commit is contained in:
parent
6611ca31b6
commit
1736384612
|
@ -36,7 +36,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy do
|
|||
new_files =
|
||||
for {emojo_shortcode, emojo_url} <- foreign_emoji,
|
||||
!has_emojo(installed_emoji, emojo_shortcode) do
|
||||
Logger.debug("HANDLING EMOJO")
|
||||
Logger.debug("HANDLING EMOJO #{emojo_shortcode} #{emojo_url}")
|
||||
|
||||
cond do
|
||||
!String.match?(emojo_shortcode, ~r/^[[:word:]]+$/) ->
|
||||
|
@ -47,13 +47,14 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy do
|
|||
remote_emojo = HTTPoison.get!(emojo_url)
|
||||
|
||||
if remote_emojo.status_code == 200 do
|
||||
emoji_dir_path = Path.join(Config.get!([:instance, :static_dir]), "emoji/stolen")
|
||||
Logger.debug("got remote emoji")
|
||||
emoji_dir_path = Path.join(Pleroma.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([emoji_dir_path, "priv/static/emoji/stolen", filename])
|
||||
new_file = Path.join([emoji_dir_path, filename])
|
||||
|
||||
{:ok, file} = File.open(new_file, [:write])
|
||||
IO.binwrite(file, remote_emojo.body)
|
||||
|
|
Loading…
Reference in New Issue