Skip to content

fix(gmail): preserve Cc recipients regardless of header casing - #923

Closed
ZIFeIYUuuuuuu wants to merge 1 commit into
googleworkspace:mainfrom
ZIFeIYUuuuuuu:fix/911-gmail-cc-header-case
Closed

fix(gmail): preserve Cc recipients regardless of header casing#923
ZIFeIYUuuuuuu wants to merge 1 commit into
googleworkspace:mainfrom
ZIFeIYUuuuuuu:fix/911-gmail-cc-header-case

Conversation

@ZIFeIYUuuuuuu

Copy link
Copy Markdown

Fix Gmail +reply-all dropping Cc recipients when header casing differs

Problem

Gmail header names are case-insensitive, but +reply-all only recognized the exact spelling Cc. Messages returned with CC, cc, or another casing were parsed without any Cc recipients, so the reply omitted people who were copied on the original message.

Minimal reproduction:

  1. Reply-all to a message whose Gmail API payload contains a header such as { "name": "CC", "value": "alice@example.com" }.
  2. The current parser falls through to _ and leaves ParsedMessageHeaders.cc empty.
  3. The generated reply therefore does not include the original Cc recipient.

Root cause

parse_message_headers used a case-sensitive string match for "Cc". RFC 5322 header field names are case-insensitive, and Gmail can return equivalent casing variants.

Changes

  • Match the Cc header with eq_ignore_ascii_case("Cc") while preserving existing address-list concatenation and formatting.
  • Add a focused regression test covering both CC and cc headers and asserting that both recipients are retained.
  • Add the required patch changeset.

Validation

  • cargo test -p google-workspace-cli helpers::gmail::tests -- --nocapture (113 passed)
  • cargo test -p google-workspace-cli helpers::gmail::tests::test_parse_message_headers_preserves_cc_regardless_of_header_case -- --exact --nocapture (1 passed)
  • cargo fmt --all -- --check (passed)
  • cargo clippy -p google-workspace-cli -- -D warnings -A clippy::collapsible-match (passed; the allow is for an existing unrelated warning in helpers/script.rs)
  • git diff --check (passed)

Other header handling and normal truncation/error behavior are unchanged. This closes #911.

@googleworkspace-bot googleworkspace-bot added the area: core Core CLI parsing, commands, error handling, utilities label Sep 9, 2026
@changeset-bot

changeset-bot Bot commented Sep 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d907083

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@googleworkspace/cli Patch

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

@google-cla

google-cla Bot commented Sep 9, 2026

Copy link
Copy Markdown

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.

@ZIFeIYUuuuuuu
ZIFeIYUuuuuuu force-pushed the fix/911-gmail-cc-header-case branch from 9d85859 to d907083 Compare September 9, 2026 10:22
@googleworkspace-bot

Copy link
Copy Markdown
Collaborator

/gemini review

@github-actions

Copy link
Copy Markdown
Contributor

This PR has been inactive for 72 hours. Closing to keep the queue clean.

@github-actions github-actions Bot added the Stale label Sep 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR was closed because it has been stalled for 72 hours. Feel free to magically reopen it if you want to continue working on it!

@github-actions github-actions Bot closed this Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Core CLI parsing, commands, error handling, utilities Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gmail +reply-all drops the original message's CC recipients (v0.22.5)

2 participants