Skip to content

Commit

Permalink
add detection of truncated final record, as per #138
Browse files Browse the repository at this point in the history
  • Loading branch information
ikreymer committed Mar 21, 2024
1 parent 8c305f5 commit 162ca0a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion warcio/archiveiterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ def _iterate_records(self):

yield self.record

except EOFError:
except EOFError as e:
if self.reader.decompressor:
if not self.reader.decompressor.eof:
msg = "warning: final record appears to be truncated"
sys.stderr.write(msg + "\n")
raise ArchiveLoadFailed(msg)

empty_record = True

self.read_to_end()
Expand Down

0 comments on commit 162ca0a

Please sign in to comment.