From 491e3d7d91c853ee7c633e28c0c941a13725fbff Mon Sep 17 00:00:00 2001 From: cquest Date: Fri, 24 Jan 2025 14:56:19 +0100 Subject: [PATCH] support image/jpeg in addition to image/jpg --- tootbot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tootbot.py b/tootbot.py index d852ec6..49ea3e0 100755 --- a/tootbot.py +++ b/tootbot.py @@ -235,12 +235,13 @@ if source[:4] == 'http': break elif 'links' in t: for l in t.links: - if l.type in ('image/gif', 'image/jpg', 'image/png', 'image/webp'): + if l.type in ('image/gif', 'image/jpg', 'image/jpeg', 'image/png', 'image/webp'): media = requests.get(l.url, headers = {'User-agent': 'Mozilla/5.0'}) if media.status_code == 200: media_posted = mastodon_api.media_post( media.content, mime_type=media.headers.get('content-type')) toot_media.append(media_posted['id']) + break # replace short links by original URL m = re.search(r"http[^ \xa0]*", c)