attribution is a list

main
Bob Mottram 2023-05-17 21:52:59 +01:00
parent 51c97949f1
commit 9d9b1a2732
2 changed files with 8 additions and 7 deletions

View File

@ -633,7 +633,7 @@ def attach_media(base_dir: str, http_prefix: str,
attachment_json['license'] = content_license_url attachment_json['license'] = content_license_url
if creator: if creator:
attachment_json['schema:creator'] = creator attachment_json['schema:creator'] = creator
attachment_json['attribution'] = creator attachment_json['attribution'] = [creator]
if media_type.startswith('image/'): if media_type.startswith('image/'):
attachment_json['blurhash'] = _get_blur_hash() attachment_json['blurhash'] = _get_blur_hash()
# find the dimensions of the image and add them as metadata # find the dimensions of the image and add them as metadata

View File

@ -1297,12 +1297,13 @@ def get_post_attachments_as_html(base_dir: str,
system_language): system_language):
media_creator = attach['schema:creator'] media_creator = attach['schema:creator']
elif attach.get('attribution'): elif attach.get('attribution'):
if len(attach['attribution']) < 120: if isinstance(attach['attribution'], list):
if not dangerous_markup(attach['attribution'], False): if len(attach['attribution']) > 0:
if not is_filtered(base_dir, nickname, domain, attrib_str = attach['attribution'][0]
attach['attribution'], if not dangerous_markup(attrib_str, False):
system_language): if not is_filtered(base_dir, nickname, domain,
media_creator = attach['attribution'] attrib_str, system_language):
media_creator = attrib_str
media_type = attach['mediaType'] media_type = attach['mediaType']
image_description = '' image_description = ''