summaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/importers/common.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-23 16:14:58 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-23 16:14:58 -0800
commit2c3316f163706c86ef0316f34799bbad80a893be (patch)
tree0d11e333c4329986640163145c99638bd84fb156 /python/fatcat_tools/importers/common.py
parent40f224579ab4001aba9838ddfa90c1b87b129b17 (diff)
downloadfatcat-2c3316f163706c86ef0316f34799bbad80a893be.tar.gz
fatcat-2c3316f163706c86ef0316f34799bbad80a893be.zip
clean() checks if it returns null-length string
Diffstat (limited to 'python/fatcat_tools/importers/common.py')
-rw-r--r--python/fatcat_tools/importers/common.py6
1 files changed, 5 insertions, 1 deletions
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():