# HG changeset patch # User Ludovic Chabant # Date 1681933738 25200 # Node ID 20d4cf433704332d9b423114d957615229ce6955 # Parent 69a6a8c9d33d14f469634da4bb100163c09ec31d Improve media attachment MIME detection, and fallback to JPEG on fail diff -r 69a6a8c9d33d -r 20d4cf433704 silorider/silos/base.py --- a/silorider/silos/base.py Wed Apr 19 12:48:25 2023 -0700 +++ b/silorider/silos/base.py Wed Apr 19 12:48:58 2023 -0700 @@ -133,8 +133,9 @@ def _do_upload_silo_media(url, callback): logger.debug("Downloading %s for upload to silo..." % url) - mt, enc = mimetypes.guess_type(url) + mt, enc = mimetypes.guess_type(url, strict=False) if not mt: + logger.debug("Can't guess MIME type, defaulting to jpg") mt = mimetypes.common_types['.jpg'] ext = mimetypes.guess_extension(mt) or '.jpg'