1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 15:10:01 +00:00

Replace newlines with html entities in torrent description

Fixes #60
On production, Cloudflare minifies our HTML which removes blank newlines from the source and therefore the description.
Replacing them with HTML entities fixes the problem.
This commit is contained in:
TheAMM 2017-05-14 23:28:22 +03:00
parent 16c30413dc
commit 2c013090e0

View file

@ -60,7 +60,8 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-body" id="torrent-description"> <div class="panel-body" id="torrent-description">
{% if torrent.description %} {% if torrent.description %}
{{ torrent.description | escape }} {# Escape newlines into html entities because CF strips blank newlines #}
{{ torrent.description | escape | replace('\r\n', '\n') | replace('\n', '&#10;'|safe) }}
{% else %} {% else %}
#### No description. #### No description.
{% endif%} {% endif%}