diff --git a/tools/file_operations.py b/tools/file_operations.py index 4202e7972..8305eb9c4 100644 --- a/tools/file_operations.py +++ b/tools/file_operations.py @@ -580,8 +580,10 @@ class ShellFileOperations(FileOperations): ), ) - # Get base64 content - b64_cmd = f"base64 -w 0 {self._escape_shell_arg(path)} 2>/dev/null" + # Get base64 content — pipe through tr to strip newlines portably. + # GNU base64 supports -w 0 but macOS base64 does not; both wrap by + # default, so stripping with tr is portable across all backends. + b64_cmd = f"base64 {self._escape_shell_arg(path)} 2>/dev/null | tr -d '\\n'" b64_result = self._exec(b64_cmd, timeout=30) if b64_result.exit_code != 0: