From be27f753ba01f212c0d19dc68c0657908eff30da Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Tue, 3 Dec 2024 13:12:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=95=B0=E6=8D=AE=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=9A=84=E5=A4=84=E7=90=86=EF=BC=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=99=90=E5=88=B6=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 2 +- util/data_util.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2cb30ce..576a4b1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ x-env: &template - image: fcb_photo_review:1.14.8 + image: fcb_photo_review:1.14.9 restart: always x-review: diff --git a/util/data_util.py b/util/data_util.py index 1504b5c..2d0a3ae 100644 --- a/util/data_util.py +++ b/util/data_util.py @@ -89,12 +89,16 @@ def handle_date(string): def handle_hospital(string): if not string: return "" + # 只允许汉字、数字 + string = re.sub(r'[^⺀-鿿0-9]', '', string) return string[:255] def handle_department(string): if not string: return "" + # 只允许汉字 + string = re.sub(r'[^⺀-鿿]', '', string) return string[:255] @@ -153,6 +157,8 @@ def handle_original_data(string): def handle_id(string): if not string: return "" + # 只允许字母和数字 + string = re.sub(r'[^0-9a-zA-Z]', '', string) # 防止过长存入数据库失败 return string[:50]