2.21 判断是否为招标文件时禁用判断是否扫描件 增加逻辑确保返回字符串为utf-8格式

This commit is contained in:
zy123 2025-02-21 16:26:28 +08:00
parent e3f2cb45ba
commit 50c83b0b11
3 changed files with 3 additions and 2 deletions

View File

@ -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', '<br>')
else:
return data

View File

@ -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)

View File

@ -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