From 60f92e406ce1b270f40e4de0a445536cd02e1973 Mon Sep 17 00:00:00 2001 From: lain Date: Fri, 6 Apr 2018 16:35:54 +0200 Subject: [PATCH] Accept port number in urls. --- lib/pleroma/formatter.ex | 2 +- test/formatter_test.exs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index b30e04e3d..515909af1 100644 --- a/lib/pleroma/formatter.ex +++ b/lib/pleroma/formatter.ex @@ -144,7 +144,7 @@ def get_custom_emoji() 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 index ff882f8f1..4c65b26f2 100644 --- a/test/formatter_test.exs +++ b/test/formatter_test.exs @@ -34,6 +34,13 @@ test "turning urls into links" do assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected + text = "https://mastodon.social:4000/@lambadalambda" + + expected = + "https://mastodon.social:4000/@lambadalambda" + + assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected + text = "@lambadalambda" expected = "@lambadalambda"