Skip to content
Snippets Groups Projects
Commit c426a5d9 authored by dtluna's avatar dtluna
Browse files

Change @link_regex to match any URL scheme

parent fef8daa4
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -71,6 +71,15 @@ defmodule Pleroma.FormatterTest do
"<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
text = "mumble://voluntaryism.club"
expected = "<a href='mumble://voluntaryism.club'>mumble://voluntaryism.club</a>"
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
text = "xmpp://voluntaryism.club"
expected = "<a href='xmpp://voluntaryism.club'>xmpp://voluntaryism.club</a>"
assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment