mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-10 02:05:12 +00:00
Merge branch 'fix/emoji-encoding' into 'develop'
URI.encode custom emojis Closes #2381 See merge request pleroma/pleroma!3235
This commit is contained in:
commit
18296c7473
|
@ -1,2 +1,3 @@
|
|||
firefox, /emoji/Firefox.gif, Gif,Fun
|
||||
blank, /emoji/blank.png, Fun
|
||||
dinosaur, /emoji/dino walking.gif, Gif
|
||||
|
|
|
@ -919,7 +919,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||
|
||||
defp build_emoji_tag({name, url}) do
|
||||
%{
|
||||
"icon" => %{"url" => url, "type" => "Image"},
|
||||
"icon" => %{"url" => "#{URI.encode(url)}", "type" => "Image"},
|
||||
"name" => ":" <> name <> ":",
|
||||
"type" => "Emoji",
|
||||
"updated" => "1970-01-01T00:00:00Z",
|
||||
|
|
BIN
priv/static/emoji/dino walking.gif
Normal file
BIN
priv/static/emoji/dino walking.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
|
@ -281,6 +281,21 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
|
||||
{:ok, _modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
end
|
||||
|
||||
test "custom emoji urls are URI encoded" do
|
||||
# :dinosaur: filename has a space -> dino walking.gif
|
||||
user = insert(:user)
|
||||
|
||||
{:ok, activity} = CommonAPI.post(user, %{status: "everybody do the dinosaur :dinosaur:"})
|
||||
|
||||
{:ok, prepared} = Transmogrifier.prepare_outgoing(activity.data)
|
||||
|
||||
assert length(prepared["object"]["tag"]) == 1
|
||||
|
||||
url = prepared["object"]["tag"] |> List.first() |> Map.get("icon") |> Map.get("url")
|
||||
|
||||
assert url == "http://localhost:4001/emoji/dino%20walking.gif"
|
||||
end
|
||||
end
|
||||
|
||||
describe "user upgrade" do
|
||||
|
|
Loading…
Reference in a new issue