1
0
mirror of https://git.pleroma.social/sjw/pleroma.git synced 2024-12-23 11:15:05 +01:00

Handle + in links.

This commit is contained in:
lain 2018-04-04 11:29:03 +02:00
parent bf953989cd
commit 81600c94f4
2 changed files with 8 additions and 1 deletions

View File

@ -144,7 +144,7 @@ defmodule Pleroma.Formatter do
@emoji
end
@link_regex ~r/https?:\/\/[\w\.\/?=\-#%&@~\(\)]+[\w\/]/u
@link_regex ~r/https?:\/\/[\w\.\/?=\-#\+%&@~\(\)]+[\w\/]/u
def html_escape(text) do
Regex.split(@link_regex, text, include_captures: true)

View File

@ -57,6 +57,13 @@ defmodule Pleroma.FormatterTest do
"<a href='https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul'>https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul</a>"
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
text = "https://www.google.co.jp/search?q=Nasim+Aghdam"
expected =
"<a href='https://www.google.co.jp/search?q=Nasim+Aghdam'>https://www.google.co.jp/search?q=Nasim+Aghdam</a>"
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
end
end