Parcourir la source

Handle + in links.

tags/v0.9.9
lain il y a 6 ans
Parent
révision
81600c94f4
2 fichiers modifiés avec 8 ajouts et 1 suppressions
  1. +1
    -1
      lib/pleroma/formatter.ex
  2. +7
    -0
      test/formatter_test.exs

+ 1
- 1
lib/pleroma/formatter.ex Voir le fichier

@@ -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)


+ 7
- 0
test/formatter_test.exs Voir le fichier

@@ -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



Chargement…
Annuler
Enregistrer