From 2c3316f163706c86ef0316f34799bbad80a893be Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 23 Jan 2019 16:14:58 -0800 Subject: clean() checks if it returns null-length string --- python/fatcat_tools/importers/common.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'python/fatcat_tools/importers') diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py index 1c99c7d7..89203a4f 100644 --- a/python/fatcat_tools/importers/common.py +++ b/python/fatcat_tools/importers/common.py @@ -32,7 +32,11 @@ def clean(thing, force_xml=False): fix_entities = 'auto' if force_xml: fix_entities = True - return ftfy.fix_text(thing, fix_entities=fix_entities).strip() + fixed = ftfy.fix_text(thing, fix_entities=fix_entities).strip() + if not fixed: + # wasn't zero-length before, but is now; return None + return None + return fixed def test_clean(): -- cgit v1.2.3