fix(output): write JSON-wrapped base64 attachment payloads with --output#724
fix(output): write JSON-wrapped base64 attachment payloads with --output#724jeevan6996 wants to merge 2 commits intogoogleworkspace:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 5750dc8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the CLI's handling of JSON responses that contain binary attachments, specifically targeting APIs like Gmail. It ensures that when a user specifies an output file, the CLI correctly identifies, decodes, and persists the binary data rather than ignoring it. The changes also introduce necessary validation to prevent conflicting flag usage and include robust testing to ensure future stability. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request enables the --output flag to decode JSON-wrapped base64url payloads and write the binary data to disk. Review feedback identifies a compilation error in the added tests due to an undefined function and suggests that the implementation should fall back to writing raw JSON when no base64 payload is detected to avoid regressions in CLI behavior.
|
I intentionally kept the behaviour fail-loud for --output when JSON does not contain a decodable base64url data field, because the issue here is silent success with no file written. Returning a clear validation error makes the failure visible and prevents data-loss-style false positives in automation flows. Happy to adjust to a different fallback if maintainers prefer (for example, explicit opt-in to write raw JSON). |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request enables the --output flag to decode and save JSON-wrapped base64url payloads, such as Gmail attachments, directly to disk. It introduces a new helper function for base64url decoding, adds validation to prevent the use of --output with --page-all for JSON responses, and includes unit tests to verify the decoding and file-writing logic. I have no feedback to provide as there were no review comments.
Summary
--outputhandle JSON responses that contain base64url binary payloads in adatafield (for examplegmail.users.messages.attachments.get)--outputis used with JSON responses that do not contain a decodabledatapayloadFixes #714
Validation
cargois not installed (command not found)