Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
ef898957
Commit
ef898957
authored
Jun 26, 2014
by
Jason Bau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow <img> tags in LTI2.0 feedback
parent
501e83d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletions
+7
-1
common/lib/xmodule/xmodule/lti_module.py
+5
-1
common/lib/xmodule/xmodule/tests/test_lti20_unit.py
+2
-0
No files found.
common/lib/xmodule/xmodule/lti_module.py
View file @
ef898957
...
...
@@ -350,7 +350,11 @@ class LTIModule(LTIFields, LTI20ModuleMixin, XModule):
# 'acronym': ['title'],
#
# This lets all plaintext through.
sanitized_comment
=
bleach
.
clean
(
self
.
score_comment
)
allowed_tags
=
bleach
.
ALLOWED_TAGS
+
[
u'img'
]
allowed_attrs
=
bleach
.
ALLOWED_ATTRIBUTES
.
copy
()
allowed_attrs
[
u'img'
]
=
[
u'src'
,
u'height'
,
u'width'
,
u'alt'
,
u'title'
]
sanitized_comment
=
bleach
.
clean
(
self
.
score_comment
,
tags
=
allowed_tags
,
attributes
=
allowed_attrs
)
return
{
'input_fields'
:
self
.
get_input_fields
(),
...
...
common/lib/xmodule/xmodule/tests/test_lti20_unit.py
View file @
ef898957
...
...
@@ -37,6 +37,8 @@ class LTI20RESTResultServiceTest(LogicTest):
(
u"plaintext"
,
u"plaintext"
),
(
u"a <script>alert(3)</script>"
,
u"a <script>alert(3)</script>"
),
# encodes scripts
(
u"<b>bold 包</b>"
,
u"<b>bold 包</b>"
),
# unicode, and <b> tags pass through
(
u'<img src="image.jpg" alt="alt" title="title" height="50" width="50">'
,
# attributes are not identical
u'<img src="image.jpg" alt="alt" height="50" width="50" title="title">'
)
# b/c sanitizer changes order
)
for
case
in
test_cases
:
self
.
xmodule
.
score_comment
=
case
[
0
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment