Skip to content

Commit

Permalink
alternative attempt: unescape all entities
Browse files Browse the repository at this point in the history
  • Loading branch information
petschki committed Nov 22, 2023
1 parent 850b8a2 commit af8bb56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions plone/app/content/browser/vocabulary.py
@@ -1,5 +1,6 @@
from AccessControl import getSecurityManager
from Acquisition import aq_base
from html import unescape
from logging import getLogger
from plone.app.content.utils import json_dumps
from plone.app.content.utils import json_loads
Expand Down Expand Up @@ -260,8 +261,10 @@ def __call__(self):
else:
items = [
{
"id": transform.scrub_html(item.value).replace("&", "&"),
"text": transform.scrub_html(item.title).replace("&", "&") if item.title else "",
"id": unescape(transform.scrub_html(item.value)),
"text": unescape(transform.scrub_html(item.title))
if item.title
else "",
}
for item in results
]
Expand Down
2 changes: 1 addition & 1 deletion plone/app/content/tests/test_widgets.py
Expand Up @@ -270,7 +270,7 @@ def testVocabularyEncoding(self):
self.assertEqual(result["id"], test_val)

def testVocabularyHtmlEntity(self):
""" The vocabulary token should not convert to htmlentities.
"""The vocabulary token should not convert to htmlentities.
See https://github.com/plone/Products.CMFPlone/issues/3874
"""
test_val = "Question & Answer"
Expand Down

0 comments on commit af8bb56

Please sign in to comment.