Fix Unicode space handling in macOS screenshot filenames
macOS uses U+202F (Narrow No-Break Space) in screenshot filenames between the time and am/pm. When users type or paste these paths, they use regular spaces, causing file-not-found errors. Changes: - Add resolve_path_with_unicode_fallback() to try U+202F variants - Add resolve_paths_in_shell_command() for shell command paths - Apply fix to read_file, read_image, and shell tools - Fix read_image prompt docs: file_path -> file_paths (array) - Add 6 unit tests for Unicode space normalization
This commit is contained in:
@@ -4,6 +4,7 @@ use anyhow::Result;
|
||||
use tracing::debug;
|
||||
|
||||
use crate::ui_writer::UiWriter;
|
||||
use crate::utils::resolve_paths_in_shell_command;
|
||||
use crate::utils::shell_escape_command;
|
||||
use crate::ToolCall;
|
||||
|
||||
@@ -22,7 +23,10 @@ pub async fn execute_shell<W: UiWriter>(tool_call: &ToolCall, ctx: &ToolContext<
|
||||
};
|
||||
|
||||
debug!("Command string: {}", command);
|
||||
let escaped_command = shell_escape_command(command);
|
||||
// First resolve any file paths with Unicode space fallback (macOS screenshot names)
|
||||
let resolved_command = resolve_paths_in_shell_command(command);
|
||||
debug!("Resolved command: {}", resolved_command);
|
||||
let escaped_command = shell_escape_command(&resolved_command);
|
||||
|
||||
let executor = g3_execution::CodeExecutor::new();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user