fix: skip macOS specific metadata directories and files in zip parsing

--bug=1054264 --user=刘瑞斌 【知识库】QA问答对模式,导入在mac上压缩的zip文件,会出现2个乱码文档 https://www.tapd.cn/57709429/s/1679674
This commit is contained in:
CaptainB 2025-04-02 16:05:32 +08:00
parent bd900118f4
commit 27bc01d442

View File

@ -132,7 +132,8 @@ class ZipParseQAHandle(BaseParseQAHandle):
files = zip_ref.namelist() files = zip_ref.namelist()
# 读取压缩包中的文件内容 # 读取压缩包中的文件内容
for file in files: for file in files:
if file.endswith('/'): # 跳过 macOS 特有的元数据目录和文件
if file.endswith('/') or file.startswith('__MACOSX'):
continue continue
with zip_ref.open(file) as f: with zip_ref.open(file) as f:
# 对文件内容进行处理 # 对文件内容进行处理