Skip to content

fix(gmail): avoid double quoted-printable decode + drive/docs improvements#162

Closed
salmonumbrella wants to merge 21 commits intoopenclaw:mainfrom
salmonumbrella:fix/issue-159-gmail-get-qp
Closed

fix(gmail): avoid double quoted-printable decode + drive/docs improvements#162
salmonumbrella wants to merge 21 commits intoopenclaw:mainfrom
salmonumbrella:fix/issue-159-gmail-get-qp

Conversation

@salmonumbrella
Copy link
Copy Markdown
Contributor

@salmonumbrella salmonumbrella commented Feb 2, 2026

Summary

  • Gmail: Fix double quoted-printable decoding that was corrupting message bodies with = characters
  • Drive: Add --convert flag to upload command for converting Office files to Google Workspace formats; include shared drives in ls and search commands; validate download formats
  • Calendar: Fix --to flag to properly expand date-only expressions (e.g., --to monday now includes end of day)
  • Docs: Add write and update commands for creating and modifying Google Docs content

Closes #159

Test plan

  • Unit tests for QP encoding helpers
  • Unit tests for drive upload convert MIME type mapping
  • Integration test verifying upload metadata includes correct MIME type
  • Tests for calendar date expression expansion
  • Tests for docs write/update commands
  • All existing tests pass (go test ./...)

🤖 Generated with Claude Code

salmonumbrella and others added 21 commits January 30, 2026 19:15
- Fix variable shadowing in DocsUpdateCmd (govet: shadow)
- Extract formatAuto constant to satisfy goconst linter

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Cover the readTextInput function and file path expansion logic
by testing DocsWriteCmd and DocsUpdateCmd with temp files.
Also test error cases: non-existent file, empty file, and
mutual exclusion of --text and --file flags.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Test that --index flag properly rejects zero and negative values
with the expected error message.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Distinguish the update command from write by specifying it inserts
text at a specific index position in the document.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add integration tests verifying isDayExpr() integration:
- TestResolveTimeRangeWithDefaultsToTomorrowEndOfDay: verifies
  --to tomorrow expands to end-of-day (23:59:59.999999999)
- TestResolveTimeRangeWithDefaultsToNowNoExpansion: verifies
  --to now does NOT expand to end-of-day (remains current time)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add boolTrue/boolFalse constants for string "true"/"false" values
- Rename shadowed err variable to writeErr in test file

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rename err to convertErr to avoid shadowing the err variable
declared earlier in the function.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@salmonumbrella salmonumbrella changed the title fix(gmail): avoid double quoted-printable decode fix(gmail): avoid double quoted-printable decode + drive/docs improvements Feb 2, 2026
@chadrwalters
Copy link
Copy Markdown

I've tested this PR extensively and can confirm all features work well:

  • gog docs write and gog docs update commands work perfectly for programmatic document editing
  • gog drive upload --convert successfully converts docx to Google Docs format

These features enable some great automation workflows - would love to see this merged!

(I've set up a fork with this PR merged at degree-analytics/gogcli as a temporary solution while this PR is pending)

@steipete
Copy link
Copy Markdown
Collaborator

Slimmed and rebased into PR #256 (branch pr-162-slim).

Reason: most of #162 content already landed on main; #256 keeps only remaining Drive deltas + tests.

Credit preserved: original commits by @salmonumbrella.

@steipete steipete closed this Feb 14, 2026
itsjeremyjohnson added a commit to Robben-Media/gogcli that referenced this pull request Feb 16, 2026
…helpers tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
itsjeremyjohnson added a commit to Robben-Media/gogcli that referenced this pull request Feb 16, 2026
- Fix auth_add_test mock signature to include client param
- Remove DocsUpdateCmd tests referencing old text-insert interface
- Fix gmail double QP decode (port logic from PR openclaw#162)
- Format code with gofumpt

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: gmail get corrupts URLs in email body (quoted-printable decoding issue)

3 participants