Transmogrifier: Encode Emoji id to be valid.
This commit is contained in:
parent
4a28b81b59
commit
1ae5c2b020
1
changelog.d/3280-fix-emoji-ids.fix
Normal file
1
changelog.d/3280-fix-emoji-ids.fix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix Emoji object IDs not always being valid
|
@ -913,9 +913,11 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|
|||||||
|
|
||||||
def add_emoji_tags(object), do: object
|
def add_emoji_tags(object), do: object
|
||||||
|
|
||||||
defp build_emoji_tag({name, url}) do
|
def build_emoji_tag({name, url}) do
|
||||||
|
url = URI.encode(url)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
"icon" => %{"url" => "#{URI.encode(url)}", "type" => "Image"},
|
"icon" => %{"url" => "#{url}", "type" => "Image"},
|
||||||
"name" => ":" <> name <> ":",
|
"name" => ":" <> name <> ":",
|
||||||
"type" => "Emoji",
|
"type" => "Emoji",
|
||||||
"updated" => "1970-01-01T00:00:00Z",
|
"updated" => "1970-01-01T00:00:00Z",
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
defmodule Pleroma.Web.ActivityPub.Transmogrifier.EmojiTagBuildingTest do
|
||||||
|
use Pleroma.DataCase, async: true
|
||||||
|
|
||||||
|
alias Pleroma.Web.ActivityPub.Transmogrifier
|
||||||
|
|
||||||
|
test "it encodes the id to be a valid url" do
|
||||||
|
name = "hanapog"
|
||||||
|
url = "https://misskey.local.live/emojis/hana pog.png"
|
||||||
|
|
||||||
|
tag = Transmogrifier.build_emoji_tag({name, url})
|
||||||
|
|
||||||
|
assert tag["id"] == "https://misskey.local.live/emojis/hana%20pog.png"
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user