commit: 60f92e406ce1b270f40e4de0a445536cd02e1973
parent 303289d7daac3a51f991bb8603f36628a5d944c1
Author: lain <lain@soykaf.club>
Date: Fri, 6 Apr 2018 16:35:54 +0200
Accept port number in urls.
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex
@@ -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)
diff --git a/test/formatter_test.exs b/test/formatter_test.exs
@@ -34,6 +34,13 @@ defmodule Pleroma.FormatterTest do
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
+ text = "https://mastodon.social:4000/@lambadalambda"
+
+ expected =
+ "<a href='https://mastodon.social:4000/@lambadalambda'>https://mastodon.social:4000/@lambadalambda</a>"
+
+ assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
+
text = "@lambadalambda"
expected = "@lambadalambda"