mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-13 00:15:05 +00:00
SearchForPattern: validate relative_path before search
This commit is contained in:
1 parent
66a6c508f8
commit
a4092ca276
1 file changed
+4
@@ -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.")
|
||||
|
||||
Reference in new issue
Block a user