aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-01-21 11:26:22 -0800
committerBryan Newbold <bnewbold@archive.org>2020-01-21 11:26:24 -0800
commit8b9acb1d31b4b8ae84a5133e947ca0a577cd98d8 (patch)
tree07e5165275e1e7496fad0e4a3e5cf5e7afab4ce0
parent9affaecc956854621362dfa70cc78b2602a01402 (diff)
downloadsandcrawler-8b9acb1d31b4b8ae84a5133e947ca0a577cd98d8.tar.gz
sandcrawler-8b9acb1d31b4b8ae84a5133e947ca0a577cd98d8.zip
ingest: check for null-body before file_meta
gen_file_metadata raises an assert error if body is None (or false-y in general)
-rw-r--r--python/sandcrawler/ingest.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/python/sandcrawler/ingest.py b/python/sandcrawler/ingest.py
index 38ba55c..94eb9a5 100644
--- a/python/sandcrawler/ingest.py
+++ b/python/sandcrawler/ingest.py
@@ -273,6 +273,9 @@ class IngestFileWorker(SandcrawlerWorker):
result['status'] = resource.status
return result
+ if not resource.body:
+ result['status'] = 'null-body'
+ return result
file_meta = gen_file_metadata(resource.body)
if "html" in file_meta['mimetype'] or "xml" in file_meta['mimetype']: