@@ -152,12 +152,10 @@ class C2paSigningAlg(enum.IntEnum):
152152
153153def _guess_mime_type_using_magic_number (file_path : Union [str , Path ]) -> Optional [tuple [str , str ]]:
154154 """Guess MIME type by reading file header bytes.
155- Currently supports:
156- - SVG files (start with <?xml or <svg)
157- - Image formats: PNG, JPEG, GIF, TIFF, WebP, AVIF, HEIC, HEIF, DNG
158- - Video formats: MP4, MOV, AVI
159- - Audio formats: MP3, M4A, WAV
160- - Document formats: PDF
155+ Currently supports a limited set of files, as this is best effort.
156+ You should consider adding extensions to filepaths to ensure we don't
157+ have to guess too much.
158+
161159 Args:
162160 file_path: Path to the file to check
163161 Returns:
@@ -194,6 +192,8 @@ def _guess_mime_type_using_magic_number(file_path: Union[str, Path]) -> Optional
194192 return ('webp' , 'image/webp' )
195193 elif header .startswith (b'\x00 \x00 \x00 \x20 ftypavif' ):
196194 return ('avif' , 'image/avif' )
195+ elif header .startswith (b'\x00 \x00 \x00 \x18 ftypmif1' ) or header .startswith (b'\x00 \x00 \x00 \x18 ftypmsf1' ) or header .startswith (b'\x00 \x00 \x00 \x18 ftypheic' ) or header .startswith (b'\x00 \x00 \x00 \x18 ftypheix' ):
196+ return ('heic' , 'image/heic' )
197197
198198 # Check for audio formats
199199 elif header .startswith (b'ID3' ) or header .startswith (b'\xff \xfb ' ) or header .startswith (b'\xff \xf3 ' ):
0 commit comments