Просмотр исходного кода

Accept port number in urls.

tags/v0.9.9
lain 6 лет назад
Родитель
Сommit
60f92e406c
2 измененных файлов: 8 добавлений и 1 удалений
  1. +1
    -1
      lib/pleroma/formatter.ex
  2. +7
    -0
      test/formatter_test.exs

+ 1
- 1
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)


+ 7
- 0
test/formatter_test.exs Просмотреть файл

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



Загрузка…
Отмена
Сохранить