SearchForPattern: validate relative_path before search

This commit is contained in:
Michael Panchenko committed 2026-05-08 11:14:35 +02:00
1 parent 66a6c508f8
commit a4092ca276
1 file changed
+4
+4
View File
@@ -387,6 +387,10 @@ class SearchForPatternTool(Tool):
which is why it is the default.
:return: A mapping from file paths to matched consecutive lines (0-based line numbers).
"""
relative_path = relative_path.strip()
if relative_path:
self.project.validate_relative_path(relative_path, require_not_ignored=True)
abs_path = os.path.join(self.get_project_root(), relative_path)
if not os.path.exists(abs_path):
raise FileNotFoundError(f"Relative path {relative_path} does not exist.")