fix(tools): portable base64 encoding for image reading on macOS

This commit is contained in:
charliekerfoot
2026-04-06 18:25:54 -05:00
committed by Teknium
parent 77610961be
commit 3b4dfc8e22

View File

@@ -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: