chore: clarify /workspace path error message
This commit is contained in:
parent
f725212988
commit
61b6b2d492
@ -99,6 +99,7 @@ class FileManager:
|
|||||||
Returns:
|
Returns:
|
||||||
(是否有效, 错误信息, 完整路径)
|
(是否有效, 错误信息, 完整路径)
|
||||||
"""
|
"""
|
||||||
|
original_path = path
|
||||||
project_root = Path(self.project_path).resolve()
|
project_root = Path(self.project_path).resolve()
|
||||||
if project_root != self.project_path:
|
if project_root != self.project_path:
|
||||||
self.project_path = project_root
|
self.project_path = project_root
|
||||||
@ -112,6 +113,8 @@ class FileManager:
|
|||||||
# 如果成功,说明绝对路径在项目内,转换为相对路径
|
# 如果成功,说明绝对路径在项目内,转换为相对路径
|
||||||
path = str(test_path.relative_to(project_root))
|
path = str(test_path.relative_to(project_root))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
if str(original_path).replace("\\", "/").startswith("/workspace"):
|
||||||
|
return False, "路径必须在项目文件夹内。请检查是否使用的是不带/workspace的相对路径。", None
|
||||||
return False, "路径必须在项目文件夹内", None
|
return False, "路径必须在项目文件夹内", None
|
||||||
|
|
||||||
# 检查是否包含向上遍历
|
# 检查是否包含向上遍历
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user