Skip to content

Commit 2f1fe07

Browse files
committed
fix: 修复 CI Python 3.13 测试失败问题
- 移除 TxtReader 中无效的 'ansi' 编码(Python 不支持) - 修复路径遍历测试使用 .txt 扩展名以通过类型检查
1 parent 83f786a commit 2f1fe07

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

mcp_documents_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class TxtReader(DocumentReader):
115115
def read(self, file_path: str) -> str:
116116
"""Read and extract text from TXT file with encoding handling"""
117117
# Supported encodings in priority order
118-
encodings = ["utf-8", "gbk", "gb2312", "ansi", "latin-1"]
118+
encodings = ["utf-8", "gbk", "gb2312", "latin-1"]
119119

120120
for encoding in encodings:
121121
try:

tests/test_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ def test_read_document_with_path_traversal(
189189
Args:
190190
mock_context_with_temp_dir: 带有临时目录的模拟上下文
191191
"""
192-
# 尝试路径遍历攻击
193-
result = read_document(mock_context_with_temp_dir, "../../../etc/passwd")
192+
# 尝试路径遍历攻击(使用 .txt 扩展名以通过类型检查)
193+
result = read_document(mock_context_with_temp_dir, "../../../etc/passwd.txt")
194194

195195
# 应返回文件不存在的错误
196196
assert "Error:" in result

0 commit comments

Comments
 (0)