fix: correct duplicate message reporting in Go implementation
- Add DocumentSkippedError custom error type to distinguish between skipped and stored documents - Fix counter bug where skipped messages were incorrectly reported as "stored" - Enhance status reporting to show "X skipped as duplicates" for better visibility - Fix Rust implementation binary attachment handling to support all file types (images, PDFs, etc.) - Update test scripts to use correct binary names (mail2couch-go, mail2couch-rs) - Add comprehensive test configurations for implementation comparison Before: "Summary: Processed 30 messages, stored 30 new messages" (misleading when all were duplicates) After: "Summary: Processed 30 messages, stored 0 new messages" with detailed "Stored 0/30 messages from INBOX (30 skipped as duplicates)" 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
e6ab28bc9e
commit
436276f0ef
9 changed files with 127 additions and 18 deletions
|
|
@ -705,21 +705,14 @@ impl ImapClient {
|
|||
// Generate a filename for the attachment
|
||||
let filename = self.get_attachment_filename(part, index);
|
||||
|
||||
// Get the content data (try different methods based on content type)
|
||||
let body_data = if let Some(text_content) = part.get_text_contents() {
|
||||
// Text-based attachments
|
||||
log::debug!("Found text attachment content: {} bytes", text_content.len());
|
||||
text_content.as_bytes().to_vec()
|
||||
} else {
|
||||
// For now, skip attachments without text content
|
||||
// TODO: Implement binary attachment support with proper mail-parser API
|
||||
log::debug!("Skipping non-text attachment for part {} (content-type: {})", index, content_type.c_type);
|
||||
vec![]
|
||||
};
|
||||
// Get the binary content data using the proper mail-parser API
|
||||
// This works for both text and binary attachments (images, PDFs, etc.)
|
||||
let body_data = part.get_contents().to_vec();
|
||||
log::debug!("Found attachment content: {} bytes (content-type: {})", body_data.len(), content_type.c_type);
|
||||
|
||||
let content_type_str = content_type.c_type.to_string();
|
||||
|
||||
// Only create attachment stub if we have actual data
|
||||
// Create attachment stub - get_contents() always returns the full data
|
||||
if !body_data.is_empty() {
|
||||
let attachment_stub = AttachmentStub {
|
||||
content_type: content_type_str.clone(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue