diff --git a/ayon_api/utils.py b/ayon_api/utils.py index bd391b3cb..5529f121f 100644 --- a/ayon_api/utils.py +++ b/ayon_api/utils.py @@ -855,11 +855,13 @@ def _get_media_mime_type_for_content_base(content: bytes) -> Optional[str]: if content[0:4] == b"\211PNG": return "image/png" - # JPEG, JFIF or Exif - if ( - content[0:4] == b"\xff\xd8\xff\xdb" - or content[6:10] in (b"JFIF", b"Exif") - ): + # JPEG + # - [0:2] is constant b"\xff\xd8" + # (ref. https://www.file-recovery.com/jpg-signature-format.htm) + # - [2:4] Marker identifier b"\xff{?}" + # (ref. https://www.disktuna.com/list-of-jpeg-markers/) + # NOTE: File ends with b"\xff\xd9" + if content[0:3] == b"\xff\xd8\xff": return "image/jpeg" # Webp