changeset 292:a3d55cc7da18

fix another long-tail bug
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Wed, 09 Apr 2025 20:42:29 +0100
parents 70da637d1402
children 12d13a1d387f
files lib/python/cc/warc.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lib/python/cc/warc.py	Wed Apr 09 17:15:40 2025 +0100
+++ b/lib/python/cc/warc.py	Wed Apr 09 20:42:29 2025 +0100
@@ -54,9 +54,10 @@
   done: bool = bl < BUFSIZE 
   while buf.startswith(b'\r\n',bp):
     bp+=2
-  while not (done and bl == bp):
+  while not (done and bp <= bl):
     start_1: int = bp
     if not buf.startswith(b'WARC/1.0\r\n',bp):
+      breakpoint()
       raise ValueError("Not a WARC file? In %s at %s of %s (%s): %s[%s]"%(filename,
                                                                    bp,bl,fpos,
          (buf[bp:min(bl,bp+20)] if bp<bl else buf[bl-20:bl]).decode('latin-1'),