Merged upstreamCorrectnessMerged Jul 16, 2026
Accept padded Gmail raw message encoding
Fixed gogcli Gmail raw retrieval so padded and unpadded base64url payloads decode into RFC822 output instead of failing at the padding character.
openclaw/gogcli · #923
Problem
gog gmail get --format raw decoded the Gmail API raw field with base64.RawURLEncoding, which rejects trailing padding. Many valid Gmail raw payloads include one or two = padding characters, so the command printed envelope fields and then failed with illegal base64 data before emitting the raw message.
Approach
Reused the existing Gmail raw decoder for interactive raw retrieval, preserving compatibility with unpadded payloads and the existing empty-raw path. Added a command-level regression with a padded multipart-style Gmail response served by a local HTTP server.
Impact and scope
- Restores raw RFC822 export for Gmail messages whose API raw payloads include base64url padding.
- Aligns interactive gmail get raw rendering with the backup/export decoding rules already present in gogcli.
- Prevents a valid Gmail API response shape from aborting the command after partial envelope output.
Validation
- Added TestGmailGetCmd_RawAcceptsPaddedBase64URL for a padded raw response and decoded message assertion.
- Maintainer proof reports a live authenticated Gmail payload where previous main failed and the landed head emitted 12,380 decoded bytes.
- PR validation included focused command tests, go test ./..., go vet, make checks, hosted Linux/Windows/Darwin/Docker checks, and AutoReview.