Skip to content

Commit 9615254

Browse files
committed
Fix HTML escaping in FAQ actions column
1 parent 1539d42 commit 9615254

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fluent_faq/admin/base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from django.contrib.admin.widgets import AdminTextInputWidget, AdminTextareaWidget
33
from django.core.exceptions import ValidationError, ImproperlyConfigured
44
from django.core.urlresolvers import NoReverseMatch
5+
from django.utils.html import conditional_escape
6+
from django.utils.safestring import mark_safe
57
from django.utils.translation import ugettext, ugettext_lazy as _
68
from fluent_faq import appsettings
79
from fluent_contents.admin import PlaceholderFieldAdmin
@@ -125,7 +127,7 @@ def _reverse_faqpage_index(self, request, obj=None):
125127

126128
@classmethod
127129
def get_actions_column(cls, faqquestion):
128-
return u' '.join(cls._actions_column_icons(faqquestion))
130+
return mark_safe(u' '.join(conditional_escape(a) for a in cls._actions_column_icons(faqquestion)))
129131

130132
@classmethod
131133
def _actions_column_icons(cls, object):
@@ -140,10 +142,10 @@ def _actions_column_icons(cls, object):
140142
# In the second case, the edit page should still be reachable, and the "view on site" link will give an alert.
141143
pass
142144
else:
143-
actions.append(
145+
actions.append(mark_safe(
144146
u'<a href="{url}" title="{title}" target="_blank"><img src="{static}fluent_faq/img/admin/world.gif" width="16" height="16" alt="{title}" /></a>'.format(
145147
url=url, title=_('View on site'), static=settings.STATIC_URL)
146-
)
148+
))
147149
return actions
148150

149151
@classmethod

0 commit comments

Comments
 (0)