mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
✨ 优化文件内容获取逻辑,新增对非二进制文件的UTF-8解码处理,提升文件读取的稳定性和准确性。
This commit is contained in:
parent
a6031ee091
commit
3d90734534
@ -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:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user