From 2c013090e03e6efe4ee95bb1821df84b43f9d491 Mon Sep 17 00:00:00 2001 From: TheAMM Date: Sun, 14 May 2017 23:28:22 +0300 Subject: [PATCH] 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. --- nyaa/templates/view.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nyaa/templates/view.html b/nyaa/templates/view.html index 954f346..6496eb9 100644 --- a/nyaa/templates/view.html +++ b/nyaa/templates/view.html @@ -60,7 +60,8 @@
{% 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', ' '|safe) }} {% else %} #### No description. {% endif%}