Description
When using --agent mode to execute actions that return binary content (e.g., Google Drive file downloads with alt=media), the CLI's action executor reads the HTTP response as text and attempts JSON.parse(). Binary content (PDFs, images, PPTX files) causes immediate parse failure.
Reproduction
one --agent actions execute google-drive <download-action-id> <connection-key> \
--path-vars '{"fileId":"<any-file-id>"}' \
--query-params '{"alt":"media","supportsAllDrives":true}'
Expected: Binary content returned or base64-encoded
Actual: Unexpected token % or Unexpected token < (if HTML error page)
Impact
Any flow that needs to download binary files from connected platforms (Google Drive, Dropbox, etc.) cannot use the standard --agent action executor. Workaround requires bypassing the CLI and making direct HTTP requests using the platform's API, while still needing the CLI's connection credentials.
Suggested Fix
Detect non-JSON content types (application/pdf, application/octet-stream, image/*, etc.) before attempting JSON.parse(). Options:
- Return
{"type":"binary","path":"/tmp/one-download-<hash>.<ext>"} after writing to disk
- Return
{"type":"binary","base64":"..."} for small files
- Add a
--output-file <path> flag for binary downloads
Description
When using
--agentmode to execute actions that return binary content (e.g., Google Drive file downloads withalt=media), the CLI's action executor reads the HTTP response as text and attemptsJSON.parse(). Binary content (PDFs, images, PPTX files) causes immediate parse failure.Reproduction
Expected: Binary content returned or base64-encoded
Actual:
Unexpected token %orUnexpected token <(if HTML error page)Impact
Any flow that needs to download binary files from connected platforms (Google Drive, Dropbox, etc.) cannot use the standard
--agentaction executor. Workaround requires bypassing the CLI and making direct HTTP requests using the platform's API, while still needing the CLI's connection credentials.Suggested Fix
Detect non-JSON content types (
application/pdf,application/octet-stream,image/*, etc.) before attemptingJSON.parse(). Options:{"type":"binary","path":"/tmp/one-download-<hash>.<ext>"}after writing to disk{"type":"binary","base64":"..."}for small files--output-file <path>flag for binary downloads