File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -230,6 +230,11 @@ def _open(self) -> None:
230
230
trailer_reached = False
231
231
232
232
def check_required_header_comments () -> None :
233
+ """
234
+ The EPS spec requires that some headers exist.
235
+ This should be checked after all headers have been read,
236
+ or at the end of the file if that comes first.
237
+ """
233
238
if "PS-Adobe" not in self .info :
234
239
msg = 'EPS header missing "%!PS-Adobe" comment'
235
240
raise SyntaxError (msg )
@@ -270,6 +275,8 @@ def _read_comment(s: str) -> bool:
270
275
if byte == b"" :
271
276
# if we didn't read a byte we must be at the end of the file
272
277
if bytes_read == 0 :
278
+ if reading_header_comments :
279
+ check_required_header_comments ()
273
280
break
274
281
elif byte in b"\r \n " :
275
282
# if we read a line ending character, ignore it and parse what
@@ -365,8 +372,6 @@ def _read_comment(s: str) -> bool:
365
372
trailer_reached = True
366
373
bytes_read = 0
367
374
368
- check_required_header_comments ()
369
-
370
375
if not self ._size :
371
376
msg = "cannot determine EPS bounding box"
372
377
raise OSError (msg )
You can’t perform that action at this time.
0 commit comments