Correctly identify JPEG files that have no headers

This commit is contained in:
Kovid Goyal 2013-07-18 08:16:29 +05:30
parent 93e68b1398
commit ce4d12711a

View File

@ -26,6 +26,10 @@ def what(file, h=None):
finally:
if f:
f.close()
# There exist some jpeg files with no headers, only the starting two bits
# If we cannot identify as anything else, identify as jpeg.
if h[:2] == b'\xff\xd8':
return 'jpeg'
return None