Skip to content

Commit 95898de

Browse files
committed
Since we're marking the two-page extract as safe, we need to escape html-significant characters in the draft text explicitly.
- Legacy-Id: 3172
1 parent d98d27d commit 95898de

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

ietf/submit/templatetags/submit_tags.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from django import template
44
from django.conf import settings
5-
from django.utils.html import mark_safe
5+
from django.utils.html import mark_safe, escape
66

77
register = template.Library()
88

@@ -25,15 +25,15 @@ def show_two_pages(context, two_pages, validation):
2525
def two_pages_decorated_with_validation(value, validation):
2626
pages = value.first_two_pages or ''
2727
if not 'revision' in validation.warnings.keys():
28-
return mark_safe('<pre class="twopages" style="display: none;">%s</pre>' % pages)
28+
return mark_safe('<pre class="twopages" style="display: none;">%s</pre>' % escape(pages))
2929
result = '<pre class="twopages" style="display: none;">\n'
3030
for line in pages.split('\n'):
3131
if line.find('%s-%s' % (value.filename, value.revision)) > -1:
3232
result += '</pre><pre class="twopages" style="display: none; background: red;">'
33-
result += line
33+
result += escape(line)
3434
result += '\n'
3535
result += '</pre><pre class="twopages" style="display: none;">\n'
3636
else:
37-
result += line
37+
result += escape(line)
3838
result += '\n'
3939
return mark_safe(result)

0 commit comments

Comments
 (0)