From 16c80082ad7227c7d99c334a80193c967c7fd5f3 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 1 Apr 2020 00:03:00 -0500 Subject: [PATCH] Log warning if null byte is detected in size field --- .../corepos/importing/db/exporters/catapult_inventory.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py b/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py index 153fa8e..ab41358 100644 --- a/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py +++ b/rattail_corepos/corepos/importing/db/exporters/catapult_inventory.py @@ -220,7 +220,9 @@ class InventoryItemImporter(FromCore, catapult_importing.model.InventoryItemImpo # TODO: this logic may actually be client-specific? i just happened to # find some of these chars in a client DB and needed to avoid them, b/c # the openpyxl lib said IllegalCharacterError - if size is not None: + if size is not None and '\x00' in size: + log.warning("product %s has null byte in size field: %s", + product.upc, product) size = size.replace('\x00', '') price_divider = None