Updated _open check to match _accept

This commit is contained in:
Andrew Murray 2020-06-23 00:25:59 +10:00
parent 6d2fe429c2
commit 96d1a8b418

View File

@ -338,10 +338,11 @@ class JpegImageFile(ImageFile.ImageFile):
def _open(self):
s = self.fp.read(1)
s = self.fp.read(3)
if i8(s) != 255:
if s != b"\xFF\xD8\xFF":
raise SyntaxError("not a JPEG file")
s = b"\xFF"
# Create attributes
self.bits = self.layers = 0