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
|
firefox, /emoji/Firefox.gif, Gif,Fun
|
||||||
blank, /emoji/blank.png, Fun
|
blank, /emoji/blank.png, Fun
|
||||||
|
dinosaur, /emoji/dino walking.gif, Gif
|
||||||
|
|
|
@ -919,7 +919,7 @@ def add_emoji_tags(object), do: object
|
||||||
|
|
||||||
defp build_emoji_tag({name, url}) do
|
defp build_emoji_tag({name, url}) do
|
||||||
%{
|
%{
|
||||||
"icon" => %{"url" => url, "type" => "Image"},
|
"icon" => %{"url" => "#{URI.encode(url)}", "type" => "Image"},
|
||||||
"name" => ":" <> name <> ":",
|
"name" => ":" <> name <> ":",
|
||||||
"type" => "Emoji",
|
"type" => "Emoji",
|
||||||
"updated" => "1970-01-01T00:00:00Z",
|
"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 @@ test "it can handle Listen activities" do
|
||||||
|
|
||||||
{:ok, _modified} = Transmogrifier.prepare_outgoing(activity.data)
|
{:ok, _modified} = Transmogrifier.prepare_outgoing(activity.data)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
describe "user upgrade" do
|
describe "user upgrade" do
|
||||||
|
|
Loading…
Reference in a new issue