2.21 判断是否为招标文件时禁用判断是否扫描件 增加逻辑确保返回字符串为utf-8格式
This commit is contained in:
parent
e3f2cb45ba
commit
50c83b0b11
@ -470,6 +470,8 @@ def transform_json_values(data):
|
|||||||
elif isinstance(data, (int, float)):
|
elif isinstance(data, (int, float)):
|
||||||
return str(data)
|
return str(data)
|
||||||
elif isinstance(data, str):
|
elif isinstance(data, str):
|
||||||
|
# 替换掉超出 BMP 范围的字符(即 4 字节字符),用 ? 代替
|
||||||
|
data = re.sub(r'[^\u0000-\uffff]', '?', data) #确保返回utf-8数据
|
||||||
return data.replace('\n', '<br>')
|
return data.replace('\n', '<br>')
|
||||||
else:
|
else:
|
||||||
return data
|
return data
|
||||||
|
@ -47,7 +47,7 @@ def judge_zbfile() -> Any: #判断是否是招标文件
|
|||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
downloaded_filename = os.path.join(output_folder, "ztbfile")
|
downloaded_filename = os.path.join(output_folder, "ztbfile")
|
||||||
logger.info(f"接收到的url:{file_url}")
|
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:
|
if not downloaded_filepath or file_type == 4:
|
||||||
log_error_unique_id(unique_id, 4)
|
log_error_unique_id(unique_id, 4)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#flask_app/run_serve.py
|
#flask_app/run_serve.py
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from waitress import serve
|
from waitress import serve
|
||||||
from flask_app.start_up import create_app
|
from flask_app.start_up import create_app
|
||||||
|
Loading…
x
Reference in New Issue
Block a user