From 5ef1ef4e08d356f86d9e5aaae9470fb45776b343 Mon Sep 17 00:00:00 2001 From: Birger Schacht Date: Thu, 22 Feb 2024 10:03:03 +0100 Subject: [PATCH] fix: don't return str(None) Closes: #44 --- viecpro_typesense/handlers.py | 8 ++++---- viecpro_typesense_detail/details/utils.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/viecpro_typesense/handlers.py b/viecpro_typesense/handlers.py index 8e01b09..feaadd8 100644 --- a/viecpro_typesense/handlers.py +++ b/viecpro_typesense/handlers.py @@ -21,10 +21,10 @@ def fixstring(string): - string = str(string) - string = re.sub(REG_SKL, "", string) - string = re.sub(REG_EKL, "", string) - string = re.sub(REG_GKL, "", string) + if isinstance(string, str): + string = re.sub(REG_SKL, "", string) + string = re.sub(REG_EKL, "", string) + string = re.sub(REG_GKL, "", string) return string diff --git a/viecpro_typesense_detail/details/utils.py b/viecpro_typesense_detail/details/utils.py index b2a3f0e..83599d4 100644 --- a/viecpro_typesense_detail/details/utils.py +++ b/viecpro_typesense_detail/details/utils.py @@ -13,10 +13,10 @@ def fixstring(string): - string = str(string) - string = re.sub(REG_SKL, "", string) - string = re.sub(REG_EKL, "", string) - string = re.sub(REG_GKL, "", string) + if isinstance(string, str): + string = re.sub(REG_SKL, "", string) + string = re.sub(REG_EKL, "", string) + string = re.sub(REG_GKL, "", string) return string