优化文件内容获取逻辑,新增对非二进制文件的UTF-8解码处理,提升文件读取的稳定性和准确性。

This commit is contained in:
HibiKier 2025-08-29 11:30:28 +08:00
parent a6031ee091
commit 3d90734534

View File

@ -82,7 +82,9 @@ class RepoFileManager:
)
if response.status_code == 200:
logger.info(f"获取github文件内容成功: {f}", LOG_COMMAND)
text_content = response.content
# 确保使用UTF-8编码解析响应内容
if not is_binary_file(f):
try:
text_content = response.content.decode("utf-8")
except UnicodeDecodeError: