X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fweb%2Fcommon_api%2Futils.ex;h=869f4c5661c5cef438ee3a3cf7b45dd7745d0d93;hb=f6b06d2ac817312b36b7fe78704846541a2e9a5f;hp=30089f553abbbf1646f6cd6e748bdd0828dfd7c3;hpb=04c584391ccb726a2b4b08dfd82a1ee27f36d31b;p=akkoma
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", "
")
+ |> String.replace(~r/\r?\n/, "
")
|> (&{[], &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 = "##{tag}"
+ url = "##{tag}"
String.replace(text, full, url)
end)
end