Skip to content

Commit 70ab964

Browse files
authored
fixed 3gp detection
1 parent 31f37c4 commit 70ab964

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

filetype/types/video.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def match(self, buf):
208208

209209

210210
class M3gp(Type):
211-
"""Implements the 3gp image type matcher."""
211+
"""Implements the 3gp video type matcher."""
212212

213213
MIME = 'video/3gpp'
214214
EXTENSION = '3gp'
@@ -220,4 +220,11 @@ def __init__(self):
220220
)
221221

222222
def match(self, buf):
223-
return buf[:7] == bytearray([0x66, 0x74, 0x79, 0x70, 0x33, 0x67, 0x70])
223+
return (len(buf) > 10 and
224+
buf[ 4] == 0x66 and
225+
buf[ 5] == 0x74 and
226+
buf[ 6] == 0x79 and
227+
buf[ 7] == 0x70 and
228+
buf[ 8] == 0x33 and
229+
buf[ 9] == 0x67 and
230+
buf[10] == 0x70)

0 commit comments

Comments
 (0)