diff --git a/lib/pleroma/formatter.ex b/lib/pleroma/formatter.ex index 515909af1..6a9d16b9a 100644 --- 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/[a-z0-9]+:\/\/[\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 4c65b26f2..2dcc2b21f 100644 --- a/test/formatter_test.exs +++ b/test/formatter_test.exs @@ -71,6 +71,15 @@ defmodule Pleroma.FormatterTest do "https://www.google.co.jp/search?q=Nasim+Aghdam" assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected + + text = "mumble://voluntaryism.club" + expected = "mumble://voluntaryism.club" + assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected + + text = "xmpp://voluntaryism.club" + expected = "xmpp://voluntaryism.club" + assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected + end end