Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
scripta
eScriptorium
Commits
2d47ef78
Commit
2d47ef78
authored
Sep 15, 2020
by
Robin Tissot
Browse files
Fixes html encoding of some characters by bleach.
parent
590ba2d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/apps/api/serializers.py
View file @
2d47ef78
import
bleach
import
logging
import
html
from
django.conf
import
settings
from
django.db.utils
import
IntegrityError
...
...
@@ -162,7 +163,9 @@ class LineTranscriptionSerializer(serializers.ModelSerializer):
'versions'
,
'version_author'
,
'version_source'
,
'version_updated_at'
)
def
cleanup
(
self
,
data
):
return
bleach
.
clean
(
data
,
tags
=
[
'em'
,
'strong'
,
's'
,
'u'
],
strip
=
True
)
nd
=
bleach
.
clean
(
data
,
tags
=
[
'em'
,
'strong'
,
's'
,
'u'
],
strip
=
True
)
nd
=
html
.
unescape
(
nd
)
return
nd
def
validate_content
(
self
,
content
):
return
self
.
cleanup
(
content
)
...
...
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