Accept port number in urls.
authorlain <lain@soykaf.club>
Fri, 6 Apr 2018 14:35:54 +0000 (16:35 +0200)
committerlain <lain@soykaf.club>
Fri, 6 Apr 2018 14:35:54 +0000 (16:35 +0200)
lib/pleroma/formatter.ex
test/formatter_test.exs

index b30e04e3d907b0f9404df1f43d2be33ae445556b..515909af1bb8b00e3ceb4de8df5b08f1281b9ce5 100644 (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)
index ff882f8f1ae1ad96823451de5ed589e3808c257c..4c65b26f2817f91b399c221a52226fcaf90e7cbf 100644 (file)
@@ -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"