aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/common_api/utils.ex
diff options
context:
space:
mode:
authorkaniini <nenolod@gmail.com>2018-08-26 21:06:15 +0000
committerkaniini <nenolod@gmail.com>2018-08-26 21:06:15 +0000
commit0f5bff8c66fa2b67633fe05de8aaa1985f4d98f8 (patch)
tree45a693814a7f1f7bd2d6108732f2b75086f1fa0a /lib/pleroma/web/common_api/utils.ex
parent30261772063a30ca0ef299f441cfed4630ffb630 (diff)
parent3448b434f54e8b4749524e3ccd876359a6501845 (diff)
downloadpleroma-0f5bff8c66fa2b67633fe05de8aaa1985f4d98f8.tar.gz
Merge branch 'develop' into 'feature/relay'
# Conflicts: # lib/pleroma/web/activity_pub/utils.ex
Diffstat (limited to 'lib/pleroma/web/common_api/utils.ex')
-rw-r--r--lib/pleroma/web/common_api/utils.ex5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/pleroma/web/common_api/utils.ex b/lib/pleroma/web/common_api/utils.ex
index 30089f553..869f4c566 100644
--- a/lib/pleroma/web/common_api/utils.ex
+++ b/lib/pleroma/web/common_api/utils.ex
@@ -64,7 +64,6 @@ defmodule Pleroma.Web.CommonAPI.Utils do
def make_content_html(status, mentions, attachments, tags, no_attachment_links \\ false) do
status
- |> String.replace("\r", "")
|> format_input(mentions, tags)
|> maybe_add_attachments(attachments, no_attachment_links)
end
@@ -95,7 +94,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
def format_input(text, mentions, tags) do
text
|> Formatter.html_escape()
- |> String.replace("\n", "<br>")
+ |> String.replace(~r/\r?\n/, "<br>")
|> (&{[], &1}).()
|> Formatter.add_links()
|> Formatter.add_user_links(mentions)
@@ -109,7 +108,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
|> Enum.sort_by(fn {tag, _} -> -String.length(tag) end)
Enum.reduce(tags, text, fn {full, tag}, text ->
- url = "#<a href='#{Pleroma.Web.base_url()}/tag/#{tag}' rel='tag'>#{tag}</a>"
+ url = "<a href='#{Pleroma.Web.base_url()}/tag/#{tag}' rel='tag'>##{tag}</a>"
String.replace(text, full, url)
end)
end