Clear ssml when editing post

merge-requests/30/head
Bob Mottram 2022-12-09 13:40:04 +00:00
parent aea5fbae6b
commit dea8fab6ce
1 changed files with 18 additions and 0 deletions

View File

@ -941,10 +941,28 @@ def save_post_to_box(base_dir: str, http_prefix: str, post_id: str,
save_json(post_json_object, filename)
# if this is an outbox post with a duplicate in the inbox then save to both
# This happens for edited posts
if '/outbox/' in filename:
inbox_filename = filename.replace('/outbox/', '/inbox/')
if os.path.isfile(inbox_filename):
save_json(post_json_object, inbox_filename)
base_filename = \
filename.replace('/outbox/',
'/postcache/').replace('.json', '')
ssml_filename = base_filename + '.ssml'
if os.path.isfile(ssml_filename):
try:
os.remove(ssml_filename)
except OSError:
print('EX: save_post_to_box unable to delete ssml file ' +
ssml_filename)
html_filename = base_filename + '.html'
if os.path.isfile(html_filename):
try:
os.remove(html_filename)
except OSError:
print('EX: save_post_to_box unable to delete html file ' +
html_filename)
return filename