Skip to content

Commit dc2df9a

Browse files
committed
fix: Update code for mov
1 parent 2d46b89 commit dc2df9a

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/c2pa/c2pa.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ def _guess_mime_type_using_magic_number(file_path: Union[str, Path]) -> Optional
208208
# Generally catches MP4-based formats that were not caught above
209209
elif header[4:8] == b'ftyp' and header[8:12] in {b'mp41', b'mp42', b'isom', b'iso2', b'avc1', b'dash', b'M4V '}:
210210
return ('mp4', 'video/mp4')
211+
# MOV: look for 'ftyp' at offset 4 and major brand in common QuickTime brands
212+
elif header[4:8] == b'ftyp' and header[8:12] in {b'qt ', b'M4V '}:
213+
return ('mov', 'video/quicktime')
211214
elif header.startswith(b'RIFF') and header[8:12] == b'AVI ':
212215
return ('avi', 'video/x-msvideo')
213216

tests/test_unit_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,7 @@ def test_guess_mime_type_using_magic_number(self):
15551555
(os.path.join(extensionless_dir, "m4a"), ('m4a', 'audio/mp4')),
15561556
(os.path.join(extensionless_dir, "wav"), ('wav', 'audio/wav')),
15571557
(os.path.join(extensionless_dir, "pdf"), ('pdf', 'application/pdf')),
1558+
(os.path.join(extensionless_dir, "svg"), ('svg', 'image/svg+xml')),
15581559
]
15591560

15601561
# Test each file explicitly

0 commit comments

Comments
 (0)