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
1 changed files with 2 additions and 1 deletions

View File

@ -60,7 +60,8 @@
<div class="panel panel-default">
<div class="panel-body" id="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 %}
#### No description.
{% endif%}