logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma
commit: 81600c94f40a6edd04c1a1db634912b61c9dbc9f
parent: bf953989cd9475f888bbd975ae07ec447fbc340c
Author: lain <lain@soykaf.club>
Date:   Wed,  4 Apr 2018 11:29:03 +0200

Handle + in links.

Diffstat:

Mlib/pleroma/formatter.ex2+-
Mtest/formatter_test.exs7+++++++
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 @@ -57,6 +57,13 @@ defmodule Pleroma.FormatterTest do "<a href='https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul'>https://en.wikipedia.org/wiki/Sophia_(Gnosticism)#Mythos_of_the_soul</a>" assert Formatter.add_links({[], text}) |> Formatter.finalize() == expected + + text = "https://www.google.co.jp/search?q=Nasim+Aghdam" + + expected = + "<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 end end