fix(gmail): match message headers case-insensitively (#642)#841
fix(gmail): match message headers case-insensitively (#642)#841lucaspretti wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 68e85e5 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 addresses an issue where Gmail message headers with non-canonical casing were being silently ignored during parsing. By normalizing header names to lowercase before matching, the system now correctly handles various casing formats, ensuring that critical recipient information is preserved during reply-all operations. 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 the 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 counterproductive. 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
|
|
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. |
There was a problem hiding this comment.
Code Review
This pull request updates the Gmail message header parsing logic to be case-insensitive, adhering to RFC 5322 §1.2.2. By converting header names to ASCII lowercase before matching, it ensures that headers with non-canonical casing (such as 'CC' or 'FROM') are not silently dropped. A new unit test has been added to verify this behavior. I have no feedback to provide.
Microsoft Exchange / Outlook emit non-canonical header casing (e.g. "CC"), and the Gmail API preserves the original casing. parse_message_headers matched header names case-sensitively, so +reply-all silently dropped Cc recipients (and any header not in canonical casing) per RFC 5322 1.2.2. Match on the lowercased header name, and add a regression test covering uppercase FROM/TO/CC and lowercase message-id. Fixes googleworkspace#642
7215141 to
716ee9c
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the Gmail message header parsing in crates/google-workspace-cli/src/helpers/gmail/mod.rs to be case-insensitive, adhering to RFC 5322 §1.2.2. By converting header names to ASCII lowercase before matching, it ensures that headers with non-canonical casing (such as 'CC' or 'FROM') are not silently dropped. A new unit test has been added to verify this behavior. I have no feedback to provide.
|
@googlebot I signed it! |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request fixes Gmail message header parsing to be case-insensitive (per RFC 5322 §1.2.2) by converting header names to lowercase before matching. This prevents headers with non-canonical casing (such as 'CC' from Microsoft Exchange or Outlook) from being silently dropped. A unit test has been added to verify this behavior. There are no review comments, so I have no feedback to provide.
Summary
gws gmail +reply-allsilently dropsCcrecipients when the original message'sCcheader arrives with non-canonical casing (e.g.CC), which is common with Microsoft Exchange / Outlook. The originalTorecipients survive but the entireCclist is lost, so a reply-all can go out missing people from the thread with no error.Root cause
parse_message_headers(crates/google-workspace-cli/src/helpers/gmail/mod.rs) matched header names with an exact, case-sensitivematch. Per RFC 5322 §1.2.2 header field names are case-insensitive, and the Gmail API preserves the original casing from the sending MTA, soCC(and any other non-canonical casing) fell through to_ => {}and was silently dropped.Fix
Match on the lowercased header name so all casings are recognized. This also folds the previous
"Message-ID" | "Message-Id"special-case into a single"message-id"arm.Test
Adds
test_parse_original_message_case_insensitive_headers, which feeds Exchange-style casing (FROM,TO,CC,cc,message-id) and asserts every recipient and the message id are parsed (i.e.Ccis not dropped).Fixes #642