Skip to content

fix(fetcher): decode address names#1669

Open
2005czq wants to merge 1 commit into
floatpane:release/v1from
2005czq:fix/fetcher-decode-address-name
Open

fix(fetcher): decode address names#1669
2005czq wants to merge 1 commit into
floatpane:release/v1from
2005czq:fix/fetcher-decode-address-name

Conversation

@2005czq

@2005czq 2005czq commented Jul 9, 2026

Copy link
Copy Markdown

What?

Use the existing decodeHeader() helper for imap.Address.Name in formatAddress().

Why?

RFC 2047 encoded-word display names can currently be shown raw in address headers, for example:

=?UTF-8?B?RXhhbXBsZSBTZW5kZXI=?= <sender@example.com>

instead of:

Example Sender <sender@example.com>

@2005czq 2005czq requested a review from a team as a code owner July 9, 2026 18:42
Copilot AI review requested due to automatic review settings July 9, 2026 18:42
@floatpanebot floatpanebot added target/v1 PR targets the release/v1 branch directly bug Something isn't working area/fetcher IMAP fetch / IDLE / search size/XS Diff: 0–10 lines and removed bug Something isn't working labels Jul 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the IMAP fetcher’s address formatting so RFC 2047 encoded-word display names are decoded before being surfaced to the rest of the application, avoiding raw =?UTF-8?...?= sequences in sender strings.

Changes:

  • Decode imap.Address.Name via existing decodeHeader() when building "Name <email>" in formatAddress().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread fetcher/fetcher.go
Comment on lines 134 to 138
func formatAddress(addr imap.Address) string {
email := addr.Addr()
if addr.Name != "" {
return addr.Name + " <" + email + ">"
return decodeHeader(addr.Name) + " <" + email + ">"
}
Comment thread fetcher/fetcher.go
Comment on lines 136 to 138
if addr.Name != "" {
return addr.Name + " <" + email + ">"
return decodeHeader(addr.Name) + " <" + email + ">"
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to address this centrally in decodeHeader() in a separate PR, since decoded subjects already use the same helper.
I'll keep this PR focused on applying the existing decoder to address display names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/fetcher IMAP fetch / IDLE / search size/XS Diff: 0–10 lines target/v1 PR targets the release/v1 branch directly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants