mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-07-31 18:36:00 +00:00
fix(mcp): ignore oversized path-like text (#4582)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
60fe0c4433
commit
6fe6bad001
@ -117,10 +117,10 @@ def _local_uri_to_virtual_path(
|
||||
|
||||
try:
|
||||
real = src.resolve()
|
||||
if not real.is_file():
|
||||
return None
|
||||
except OSError:
|
||||
return None
|
||||
if not real.is_file():
|
||||
return None
|
||||
|
||||
try:
|
||||
user_data_root = get_paths().sandbox_user_data_dir(thread_id, user_id=user_id).resolve()
|
||||
|
||||
@ -203,6 +203,20 @@ class TestRewriteLocalPathsInText:
|
||||
|
||||
assert result == text
|
||||
|
||||
def test_oversized_path_like_text_is_left_untouched(self, paths: Paths):
|
||||
workspace = paths.sandbox_work_dir("t1", user_id="u1")
|
||||
text = f"手术室/重症监护室(OR/ICU)整体解决方案{'说明' * 200}"
|
||||
|
||||
with _patch_paths(paths):
|
||||
result = mcp_tools._rewrite_local_paths_in_text(
|
||||
text,
|
||||
thread_id="t1",
|
||||
user_id="u1",
|
||||
source_base_dir=workspace,
|
||||
)
|
||||
|
||||
assert result == text
|
||||
|
||||
def test_playwright_markdown_path_is_rewritten_twice_without_copy(self, paths: Paths):
|
||||
workspace = paths.sandbox_work_dir("t1", user_id="u1")
|
||||
_workspace_file(paths, ".playwright-mcp/page.png", content=b"png")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user