From 50c83b0b116fd5cfb41d4a8891f4ab24b9a78992 Mon Sep 17 00:00:00 2001 From: zy123 <646228430@qq.com> Date: Fri, 21 Feb 2025 16:26:28 +0800 Subject: [PATCH] =?UTF-8?q?2.21=20=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E4=B8=BA=E6=8B=9B=E6=A0=87=E6=96=87=E4=BB=B6=E6=97=B6=E7=A6=81?= =?UTF-8?q?=E7=94=A8=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E6=89=AB=E6=8F=8F?= =?UTF-8?q?=E4=BB=B6=20=E5=A2=9E=E5=8A=A0=E9=80=BB=E8=BE=91=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E8=BF=94=E5=9B=9E=E5=AD=97=E7=AC=A6=E4=B8=B2=E4=B8=BA?= =?UTF-8?q?utf-8=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flask_app/general/json_utils.py | 2 ++ flask_app/routes/judge_zbfile.py | 2 +- flask_app/run_serve.py | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/flask_app/general/json_utils.py b/flask_app/general/json_utils.py index 95369e1..aef4da5 100644 --- a/flask_app/general/json_utils.py +++ b/flask_app/general/json_utils.py @@ -470,6 +470,8 @@ def transform_json_values(data): elif isinstance(data, (int, float)): return str(data) elif isinstance(data, str): + # 替换掉超出 BMP 范围的字符(即 4 字节字符),用 ? 代替 + data = re.sub(r'[^\u0000-\uffff]', '?', data) #确保返回utf-8数据 return data.replace('\n', '
') else: return data diff --git a/flask_app/routes/judge_zbfile.py b/flask_app/routes/judge_zbfile.py index ba43a31..e47fef8 100644 --- a/flask_app/routes/judge_zbfile.py +++ b/flask_app/routes/judge_zbfile.py @@ -47,7 +47,7 @@ def judge_zbfile() -> Any: #判断是否是招标文件 start_time = time.time() downloaded_filename = os.path.join(output_folder, "ztbfile") logger.info(f"接收到的url:{file_url}") - downloaded_filepath, file_type = download_file(file_url, downloaded_filename,True) + downloaded_filepath, file_type = download_file(file_url, downloaded_filename,False) #判断是否为招标文件时不需要处理扫描型pdf if not downloaded_filepath or file_type == 4: log_error_unique_id(unique_id, 4) diff --git a/flask_app/run_serve.py b/flask_app/run_serve.py index 233e441..c4b58d2 100644 --- a/flask_app/run_serve.py +++ b/flask_app/run_serve.py @@ -1,7 +1,6 @@ #flask_app/run_serve.py import threading import time - import requests from waitress import serve from flask_app.start_up import create_app