logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: f9090e00e6f6bec903c8df030c4af74ac378fccf
parent 8864ac65c693eb19a36a6e0116abc13bcfe70ddb
Author: Mark Felder <feld@feld.me>
Date:   Tue,  5 Jan 2021 13:58:49 -0600

Add test to validate URLs to custom emojis are properly encoded

Diffstat:

Mtest/pleroma/web/activity_pub/transmogrifier_test.exs15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)

diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs @@ -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