Fix mentioning punycode domains when using Markdown
This commit is contained in:
parent
340c881296
commit
b748efe66a
3 changed files with 14 additions and 1 deletions
1
changelog.d/punycode-mention.fix
Normal file
1
changelog.d/punycode-mention.fix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fix mentioning punycode domains when using Markdown
|
|
@ -124,7 +124,7 @@ defmodule Pleroma.Formatter do
|
||||||
end
|
end
|
||||||
|
|
||||||
def markdown_to_html(text) do
|
def markdown_to_html(text) do
|
||||||
Earmark.as_html!(text, %Earmark.Options{compact_output: true})
|
Earmark.as_html!(text, %Earmark.Options{compact_output: true, smartypants: false})
|
||||||
end
|
end
|
||||||
|
|
||||||
def html_escape({text, mentions, hashtags}, type) do
|
def html_escape({text, mentions, hashtags}, type) do
|
||||||
|
|
|
@ -843,6 +843,18 @@ defmodule Pleroma.Web.CommonAPITest do
|
||||||
{:ok, _} = CommonAPI.post(user, %{status: "nice", quote_id: public.id})
|
{:ok, _} = CommonAPI.post(user, %{status: "nice", quote_id: public.id})
|
||||||
{:ok, _} = CommonAPI.post(another_user, %{status: "nice", quote_id: public.id})
|
{:ok, _} = CommonAPI.post(another_user, %{status: "nice", quote_id: public.id})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "it properly mentions punycode domain" do
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
|
_mentioned_user =
|
||||||
|
insert(:user, ap_id: "https://xn--i2raa.com/users/yyy", nickname: "yyy@xn--i2raa.com")
|
||||||
|
|
||||||
|
{:ok, activity} =
|
||||||
|
CommonAPI.post(user, %{status: "hey @yyy@xn--i2raa.com", content_type: "text/markdown"})
|
||||||
|
|
||||||
|
assert "https://xn--i2raa.com/users/yyy" in Object.normalize(activity).data["to"]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "reactions" do
|
describe "reactions" do
|
||||||
|
|
Loading…
Reference in a new issue