Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDAAP-123 Escaped Markup being included in headlines #942

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from flask import current_app as app
from apps.prepopulate.app_initialize import get_filepath
from superdesk import etree as sd_etree
from superdesk.text_utils import get_text
from copy import deepcopy
from superdesk.utc import utcnow
from superdesk.editor_utils import remove_all_embeds
Expand Down Expand Up @@ -277,7 +278,8 @@ def _format_news_lines(self, formatted_article, main_news_component):
"""
news_lines = SubElement(main_news_component, "NewsLines")
if formatted_article.get('headline'):
SubElement(news_lines, 'HeadLine').text = formatted_article.get('headline')
SubElement(news_lines, 'HeadLine').text = (
get_text(formatted_article.get('headline'), 'html'))
if formatted_article.get('byline'):
SubElement(news_lines, 'ByLine').text = formatted_article.get('byline') or ''
if formatted_article.get('dateline', {}).get('text', ''):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def test_embeded(self):
self.article['versioncreated'] = now
item = self.article.copy()
item.update({
'headline': 'headline is here',
'body_html':
'<p>pre amble</p>'
'<!-- EMBED START Image {id: \"editor_0\"} -->'
Expand All @@ -226,6 +227,8 @@ def test_embeded(self):
'format': 'HTML',
"fields_meta": {
"body_html": {
},
"headline": {
}
}
})
Expand All @@ -237,3 +240,5 @@ def test_embeded(self):
etree.tostring(newsml.find('./NewsItem/NewsComponent/NewsComponent/ContentItem/DataContent/'
'{http://www.w3.org/1999/xhtml}html/'
'{http://www.w3.org/1999/xhtml}body')).decode('utf-8'))
self.assertEqual('headline is here',
newsml.find('./NewsItem/NewsComponent/NewsComponent/NewsLines/HeadLine').text)
Loading