fix(gmail): bring +forward behavior in line with Gmail web UI#353
Conversation
- Pass original threadId to keep forward in sender's thread - Add In-Reply-To and References headers for RFC 5322 compliance - Add blank line between forwarded message metadata and body - Remove spurious closing delimiter from forwarded message block - Update SKILL.md to remove outdated threading tip - Add test for References chain construction Closes googleworkspace#88
🦋 Changeset detectedLatest commit: 11e3901 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 |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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 refines the Highlights
Changelog
Activity
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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request updates the Gmail +forward functionality to align with Gmail's web UI by ensuring forwarded messages remain in the original thread, adding a blank line between the forwarded message metadata and body, and removing the closing delimiter. However, a security vulnerability was identified in the create_forward_raw_message function, where unsanitized user inputs and message metadata are directly used in email headers, leading to potential Email Header Injection and an invalid MIME-Version header due to incorrect formatting.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #353 +/- ##
==========================================
+ Coverage 61.72% 61.77% +0.04%
==========================================
Files 38 38
Lines 14603 14640 +37
==========================================
+ Hits 9014 9044 +30
- Misses 5589 5596 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
The
+forwardhelper (added in #105) sends forwards as new threads, which doesn't match Gmail's web UI behavior. When you forward from Gmail, the forward stays in the sender's original conversation thread. This PR fixes that and cleans up the forwarded message formatting.Threading fix:
threadIdtosend_raw_email(matching what+replyalready does)In-Reply-ToandReferencesheaders for RFC 5322 compliance — required by the Gmail API for thread placement alongsidethreadIdFormatting fixes:
To:/Cc:line)----------delimiter that Gmail doesn't produceSKILL.md:
Related: #88
Dry Run Output:
$ gws gmail +forward --message-id 18f1a2b3c4d --to dave@example.com --body 'FYI see below' --dry-run{ "body": { "raw": "VG86IGRhdmVAZXhhbXBsZS5jb20NClN1YmplY3Q6...<truncated>", "threadId": "thread-18f1a2b3c4d" }, "dry_run": true, "is_multipart_upload": false, "method": "POST", "query_params": {}, "url": "https://gmail.googleapis.com/gmail/v1/users/me/messages/send" }Decoded
raw(base64 → plaintext):Checklist:
AGENTS.mdguidelines (no generatedgoogle-*crates).cargo fmt --allto format the code perfectly.cargo clippy -- -D warningsand resolved all warnings.pnpx changeset) to document my changes.