We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents da7837d + a3842dc commit fba7cceCopy full SHA for fba7cce
1 file changed
ayon_api/utils.py
@@ -855,11 +855,13 @@ def _get_media_mime_type_for_content_base(content: bytes) -> Optional[str]:
855
if content[0:4] == b"\211PNG":
856
return "image/png"
857
858
- # JPEG, JFIF or Exif
859
- if (
860
- content[0:4] == b"\xff\xd8\xff\xdb"
861
- or content[6:10] in (b"JFIF", b"Exif")
862
- ):
+ # 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/)
863
+ # NOTE: File ends with b"\xff\xd9"
864
+ if content[0:3] == b"\xff\xd8\xff":
865
return "image/jpeg"
866
867
# Webp
0 commit comments