mirror of https://gitlab.com/bashrc2/epicyon
Show svg images if they originate from the local domain
These will already have been vettedmerge-requests/30/head
parent
4a3e0f5cf1
commit
826cef3372
3
blog.py
3
blog.py
|
@ -259,7 +259,8 @@ def _html_blog_post_content(debug: bool, session, authorized: bool,
|
||||||
mute_str = ''
|
mute_str = ''
|
||||||
is_muted = False
|
is_muted = False
|
||||||
attachment_str, _ = \
|
attachment_str, _ = \
|
||||||
get_post_attachments_as_html(base_dir, post_json_object,
|
get_post_attachments_as_html(base_dir, domain_full,
|
||||||
|
post_json_object,
|
||||||
'tlblogs', translate,
|
'tlblogs', translate,
|
||||||
is_muted, avatar_link,
|
is_muted, avatar_link,
|
||||||
reply_str, announce_str,
|
reply_str, announce_str,
|
||||||
|
|
|
@ -1962,7 +1962,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
_log_post_timing(enable_timing_log, post_start_time, '14')
|
_log_post_timing(enable_timing_log, post_start_time, '14')
|
||||||
|
|
||||||
attachment_str, gallery_str = \
|
attachment_str, gallery_str = \
|
||||||
get_post_attachments_as_html(base_dir, post_json_object,
|
get_post_attachments_as_html(base_dir, domain_full,
|
||||||
|
post_json_object,
|
||||||
box_name, translate,
|
box_name, translate,
|
||||||
is_muted, avatar_link,
|
is_muted, avatar_link,
|
||||||
reply_str, announce_str, like_str,
|
reply_str, announce_str, like_str,
|
||||||
|
|
|
@ -1097,7 +1097,7 @@ def _is_attached_video(attachment_filename: str) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def get_post_attachments_as_html(base_dir: str,
|
def get_post_attachments_as_html(base_dir: str, domain_full: str,
|
||||||
post_json_object: {}, box_name: str,
|
post_json_object: {}, box_name: str,
|
||||||
translate: {},
|
translate: {},
|
||||||
is_muted: bool, avatar_link: str,
|
is_muted: bool, avatar_link: str,
|
||||||
|
@ -1137,15 +1137,18 @@ def get_post_attachments_as_html(base_dir: str,
|
||||||
svg_harmless = True
|
svg_harmless = True
|
||||||
if 'svg' in media_type:
|
if 'svg' in media_type:
|
||||||
svg_harmless = False
|
svg_harmless = False
|
||||||
if post_id:
|
if '://' + domain_full + '/' in image_url:
|
||||||
if '/' in image_url:
|
svg_harmless = True
|
||||||
im_filename = image_url.split('/')[-1]
|
else:
|
||||||
else:
|
if post_id:
|
||||||
im_filename = image_url
|
if '/' in image_url:
|
||||||
cached_svg_filename = \
|
im_filename = image_url.split('/')[-1]
|
||||||
base_dir + '/media/' + post_id + '_' + im_filename
|
else:
|
||||||
if os.path.isfile(cached_svg_filename):
|
im_filename = image_url
|
||||||
svg_harmless = True
|
cached_svg_filename = \
|
||||||
|
base_dir + '/media/' + post_id + '_' + im_filename
|
||||||
|
if os.path.isfile(cached_svg_filename):
|
||||||
|
svg_harmless = True
|
||||||
|
|
||||||
if _is_attached_image(attach['url']) and svg_harmless:
|
if _is_attached_image(attach['url']) and svg_harmless:
|
||||||
if not attachment_str:
|
if not attachment_str:
|
||||||
|
|
Loading…
Reference in New Issue