mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
fix: escape file glob patterns in ShellFileOperations
- Updated the file glob and include filters in the ShellFileOperations class to escape shell arguments, preventing unintended shell expansion. - Added comments to clarify the necessity of quoting for file glob patterns.
This commit is contained in:
parent
057d3e1810
commit
d070b8698d
1 changed files with 4 additions and 4 deletions
|
|
@ -814,9 +814,9 @@ class ShellFileOperations(FileOperations):
|
|||
if context > 0:
|
||||
cmd_parts.extend(["-C", str(context)])
|
||||
|
||||
# Add file glob filter
|
||||
# Add file glob filter (must be quoted to prevent shell expansion)
|
||||
if file_glob:
|
||||
cmd_parts.extend(["--glob", file_glob])
|
||||
cmd_parts.extend(["--glob", self._escape_shell_arg(file_glob)])
|
||||
|
||||
# Output mode handling
|
||||
if output_mode == "files_only":
|
||||
|
|
@ -910,9 +910,9 @@ class ShellFileOperations(FileOperations):
|
|||
if context > 0:
|
||||
cmd_parts.extend(["-C", str(context)])
|
||||
|
||||
# Add file pattern filter
|
||||
# Add file pattern filter (must be quoted to prevent shell expansion)
|
||||
if file_glob:
|
||||
cmd_parts.extend(["--include", file_glob])
|
||||
cmd_parts.extend(["--include", self._escape_shell_arg(file_glob)])
|
||||
|
||||
# Output mode handling
|
||||
if output_mode == "files_only":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue