hashtag: escape quotation marks for display_name

This commit is contained in:
knoflook 2022-02-15 13:31:33 +01:00
parent ab1f8d9d7a
commit 6339724510
Signed by untrusted user: knoflook
GPG Key ID: D6A1D0E8FC4FEF1C

View File

@ -1,6 +1,7 @@
import os
import shutil
from pathlib import Path
from re import sub
import jinja2
import requests
@ -68,7 +69,9 @@ def create_post(post_directory, post_metadata):
template_dir = os.path.join(Path(__file__).parent.resolve(), "templates")
env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_dir))
name = post_metadata['account']['display_name']
name = sub('"', '\\"', name)
post_metadata['account']['display_name'] = name
env.filters["localize_media_url"] = localize_media_url
env.filters["filter_mastodon_urls"] = filter_mastodon_urls