fix(paste): prevent \r \n characters from interfering with url redirects
Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
parent
ec4661fe44
commit
1ecb497199
@ -21,7 +21,9 @@ defmodule KetbinWeb.PageController do
|
||||
# paste is a url, redirect
|
||||
# regular paste, show content
|
||||
if paste.is_url do
|
||||
redirect(conn, external: paste.content)
|
||||
redirect(conn,
|
||||
external: paste.content |> String.replace("\r", "") |> String.replace("\n", "")
|
||||
)
|
||||
else
|
||||
render(conn, "show.html",
|
||||
paste: paste,
|
||||
|
@ -11,6 +11,6 @@
|
||||
<%= if @extension == "md" do%>
|
||||
<div class="break-word px-6 py-4 h-full w-full markdown overflow-y-auto"><%= raw Earmark.as_html!(@paste.content, escape: true, gfm_tables: true) |> HtmlSanitizeEx.markdown_html %></div>
|
||||
<% else %>
|
||||
<code class="break-word px-6 py-4 h-full w-full overflow-y-auto"><%= raw Ketbin.Utils.Syntax.highlight_text(@paste.content, @extension) |> HtmlSanitizeEx.strip_tags %></code>
|
||||
<code class="break-word px-6 py-4 h-full w-full overflow-y-auto"><%= raw Ketbin.Utils.Syntax.highlight_text(@paste.content, @extension) |> HtmlSanitizeEx.html5 %></code>
|
||||
<% end %>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user