diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-23 16:14:58 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-23 16:14:58 -0800 |
commit | 2c3316f163706c86ef0316f34799bbad80a893be (patch) | |
tree | 0d11e333c4329986640163145c99638bd84fb156 /python/fatcat_tools/importers | |
parent | 40f224579ab4001aba9838ddfa90c1b87b129b17 (diff) | |
download | fatcat-2c3316f163706c86ef0316f34799bbad80a893be.tar.gz fatcat-2c3316f163706c86ef0316f34799bbad80a893be.zip |
clean() checks if it returns null-length string
Diffstat (limited to 'python/fatcat_tools/importers')
-rw-r--r-- | python/fatcat_tools/importers/common.py | 6 |
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(): |