Skip to content

Conversation

@andrinoff
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings January 3, 2026 14:38
@andrinoff andrinoff merged commit 5772948 into floatpane:master Jan 3, 2026
5 checks passed
Copy link

Copilot AI left a comment

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 fixes the encoding of files sent from matcha by adding proper MIME line wrapping for base64-encoded data. According to RFC 2045, base64-encoded data in MIME messages must be wrapped at 76 characters per line with CRLF line endings.

Key Changes:

  • Added a new wrapBase64 utility function that wraps base64-encoded strings at 76 characters per line with proper CRLF (\r\n) line endings
  • Applied line wrapping to embedded images (inline images referenced in emails)
  • Applied line wrapping to file attachments

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

Comment on lines +163 to +178
// wrapBase64 wraps base64-encoded data at 76 characters per line as required by MIME.
func wrapBase64(data string) string {
const lineLength = 76
var result strings.Builder
for i := 0; i < len(data); i += lineLength {
end := i + lineLength
if end > len(data) {
end = len(data)
}
result.WriteString(data[i:end])
if end < len(data) {
result.WriteString("\r\n")
}
}
return result.String()
}
Copy link

Copilot AI Jan 3, 2026

Choose a reason for hiding this comment

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

The new wrapBase64 function lacks test coverage. Given that this repository has comprehensive test coverage (as seen in sender_test.go, config_test.go, etc.), a test should be added to verify the function correctly wraps base64 data at 76 characters per line with proper CRLF line endings. Test cases should include: empty string, string shorter than 76 chars, string exactly 76 chars, string longer than 76 chars, and string that requires multiple wraps.

Copilot uses AI. Check for mistakes.
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.

1 participant