Commit Graph

9 Commits

Author SHA1 Message Date
Anton Sotkov
edb8200cc1 fix(gmail): normalize MIME types in multipart bodies
Body extraction compared exact MIME types; parts often include params like
"text/plain; charset=utf-8", so multipart/alternative returned empty body
(null in JSON). Normalize MIME types (lowercase/trim/strip params) so
plain/html parts are found, preferring plain text. Also accept padded
base64url defensively.
2026-01-09 01:11:01 +01:00
salmonumbrella
72f251f729
feat(gmail): add thread attachments command (#27)
* feat(gmail): add thread attachments command

Adds `gog gmail thread attachments <threadId>` command that lists all
attachments in an email thread with human-readable sizes.

Features:
- Lists attachments across all messages in a thread
- Shows filename, size (human-readable), and MIME type
- Optional --download flag to download all attachments
- Optional --out-dir to specify download directory
- Supports both JSON and text output formats

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(auth): check keychain before token import

Add pre-flight keychain accessibility check to AuthTokensImportCmd.Run
to fail early if the keychain is locked, rather than after the user has
already completed the import process.

Also adds the EnsureKeychainAccess function to the secrets package which
performs a write/delete test to verify keychain accessibility on macOS.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* style: group const declarations for gofumpt

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: address lint issues in store.go

- Wrap keychain access error for wrapcheck linter
- Add blank lines before returns for wsl linter
- Define static error for err113 linter

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(cli): add mail and email aliases for gmail command

Enables `gog mail` and `gog email` as shortcuts for `gog gmail`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(gmail): add flattened headers to gmail get JSON output

Add a headers map with common email headers (from, to, cc, bcc, subject,
date) to the JSON output of `gog gmail get`. This makes header extraction
much simpler:

  # Before (error-prone due to jq operator precedence)
  jq '.message.payload.headers[] | select(.name == "To") | .value'

  # After
  jq '.headers.to'

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(gmail): include inline attachments

* fix(secrets): dedupe keychain helpers

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-01-05 02:26:42 +00:00
Peter Steinberger
716106da4f feat(gmail): support thread-id replies 2026-01-03 13:03:27 +01:00
salmonumbrella
0866dae212 fix(gmail): improve thread display with message count and HTML stripping
- Add message count header ("Thread contains N message(s)") so users
  know upfront how many messages to expect
- Add clear message separators with position (=== Message 1/8: id ===)
- Strip HTML <script> and <style> blocks before removing tags
- Use rune-based truncation to avoid breaking multi-byte UTF-8 chars
- Truncate long message bodies to 500 chars for cleaner output
- Add comprehensive unit tests for stripHTMLTags function

Fixes issue where threads with many messages or HTML content would
produce overwhelming output that could get truncated.
2026-01-03 13:02:59 +01:00
salmonumbrella
e7fae164f4
feat: add context propagation, security fixes, and new features
Drive:
- Add context propagation to all API calls
- Add path traversal security fix in download

Gmail:
- Add context propagation to labels and thread commands
- Simplify MIME building (remove unused ReplyTo, BodyHTML)
- Add --from flag for send-as aliases in send and drafts
- Simplify base64 decoding
- Add path traversal security fix in attachments

Calendar:
- Add needsAction status support to respond command
- Add --comment flag for response comments
- Add organizer check to prevent self-response

Auth:
- Add browser-based account management command (auth manage)
- Add web UI for managing connected accounts

Maintenance:
- Update golangci-lint config for v2 compatibility
2025-12-24 19:14:01 -08:00
Peter Steinberger
e1bc61d26b test(gmail): expand base64url decoding coverage 2025-12-24 18:09:42 +01:00
Peter Steinberger
230f800ea7 fix(gmail): harden base64url decoding 2025-12-24 18:01:59 +01:00
Shane Lindsay
cff98b2e07 fix(gmail): decode base64url attachments 2025-12-24 18:00:55 +01:00
Peter Steinberger
055b27f9fc Tests: add more coverage for helpers 2025-12-12 15:21:57 +00:00