From 8b9acb1d31b4b8ae84a5133e947ca0a577cd98d8 Mon Sep 17 00:00:00 2001
From: Bryan Newbold <bnewbold@archive.org>
Date: Tue, 21 Jan 2020 11:26:22 -0800
Subject: ingest: check for null-body before file_meta

gen_file_metadata raises an assert error if body is None (or false-y in
general)
---
 python/sandcrawler/ingest.py | 3 +++
 1 file changed, 3 insertions(+)

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']:
-- 
cgit v1.2.3