mirror of https://gitlab.com/bashrc2/epicyon
Minimal validation on post summary
parent
b1884b0691
commit
a42c884256
8
utils.py
8
utils.py
|
@ -538,8 +538,14 @@ def get_summary_from_post(post_json_object: {}, system_language: str,
|
||||||
"""Returns the summary from the post in the given language
|
"""Returns the summary from the post in the given language
|
||||||
including searching for a matching entry within summaryMap
|
including searching for a matching entry within summaryMap
|
||||||
"""
|
"""
|
||||||
return get_content_from_post(post_json_object, system_language,
|
summary_str = \
|
||||||
|
get_content_from_post(post_json_object, system_language,
|
||||||
languages_understood, "summary")
|
languages_understood, "summary")
|
||||||
|
if summary_str:
|
||||||
|
summary_str = summary_str.strip()
|
||||||
|
if len(summary_str) < 2:
|
||||||
|
summary_str = ''
|
||||||
|
return summary_str
|
||||||
|
|
||||||
|
|
||||||
def get_base_content_from_post(post_json_object: {},
|
def get_base_content_from_post(post_json_object: {},
|
||||||
|
|
|
@ -2713,6 +2713,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
|
|
||||||
post_is_sensitive = False
|
post_is_sensitive = False
|
||||||
if post_json_object['object'].get('sensitive'):
|
if post_json_object['object'].get('sensitive'):
|
||||||
|
if isinstance(post_json_object['object']['sensitive'], bool):
|
||||||
# sensitive posts should have a summary
|
# sensitive posts should have a summary
|
||||||
if post_json_object['object'].get('summary'):
|
if post_json_object['object'].get('summary'):
|
||||||
post_is_sensitive = post_json_object['object']['sensitive']
|
post_is_sensitive = post_json_object['object']['sensitive']
|
||||||
|
@ -2885,6 +2886,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
post_id = 'post' + str(create_password(8))
|
post_id = 'post' + str(create_password(8))
|
||||||
content_str = ''
|
content_str = ''
|
||||||
if summary_str:
|
if summary_str:
|
||||||
|
# set the content warning
|
||||||
cw_str = \
|
cw_str = \
|
||||||
add_emoji_to_display_name(session, base_dir, http_prefix,
|
add_emoji_to_display_name(session, base_dir, http_prefix,
|
||||||
nickname, domain,
|
nickname, domain,
|
||||||
|
|
Loading…
Reference in New Issue