Description
When retrieving emails with gog gmail get, URLs containing = characters are corrupted. The = sign is replaced with the Unicode replacement character (U+FFFD).
Steps to Reproduce
- Receive an email containing a URL with query parameters (e.g., a magic link with
?token_hash=abc123&type=xyz)
- Run
gog gmail get <message_id>
- Observe the URL in the output
Expected Behavior
URL should be intact:
https://example.com/auth?token_hash=abc123&type=magiclink
Actual Behavior
URL is corrupted:
https://example.com/auth?token_hash�abc123&type�magiclink
The = characters are replaced with � (U+FFFD).
Root Cause
The issue appears to be in the quoted-printable decoding. Emails using Content-Transfer-Encoding: quoted-printable encode = as =3D. When decoding, gog seems to mishandle this.
Workaround
Using --format=raw --json and manually decoding works correctly:
gog gmail get <id> --format=raw --json | jq -r '.message.raw' | base64 -d | python3 -c "import sys, quopri; print(quopri.decodestring(sys.stdin.read().encode()).decode())"
Environment
- gog version: v0.9.0
- OS: macOS (arm64)
- Email source: Amazon SES (multipart/alternative with quoted-printable encoding)
Description
When retrieving emails with
gog gmail get, URLs containing=characters are corrupted. The=sign is replaced with the Unicode replacement character (U+FFFD).Steps to Reproduce
?token_hash=abc123&type=xyz)gog gmail get <message_id>Expected Behavior
URL should be intact:
Actual Behavior
URL is corrupted:
The
=characters are replaced with�(U+FFFD).Root Cause
The issue appears to be in the quoted-printable decoding. Emails using
Content-Transfer-Encoding: quoted-printableencode=as=3D. When decoding, gog seems to mishandle this.Workaround
Using
--format=raw --jsonand manually decoding works correctly:Environment