fix: Date-Parsing-Fallback für nicht-standard MTA-Datumsformate

mailparser: weitere Layouts (Timezone +02:00 mit Doppelpunkt, ohne Sekunden)
storage: GetReceivedAts() für Batch-Lookup von received_at
search_handlers: received_at als Fallback wenn pm.Date.IsZero()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
sysops
2026-05-11 23:36:18 +02:00
parent 1f7e02dc53
commit a1c4e59fff
3 changed files with 39 additions and 1 deletions
+4 -1
View File
@@ -173,12 +173,13 @@ func (s *Server) handleSearch(w http.ResponseWriter, r *http.Request) {
}
}
// Batch-load thread info for all hits
// Batch-load thread info and received_at fallback for all hits
hitIDs := make([]string, len(result.Hits))
for i, h := range result.Hits {
hitIDs[i] = h.ID
}
threadInfo, _ := s.store.GetThreadInfo(r.Context(), hitIDs)
receivedAts := s.store.GetReceivedAts(r.Context(), hitIDs)
enriched := make([]enrichedHit, 0, len(result.Hits))
for _, h := range result.Hits {
@@ -193,6 +194,8 @@ func (s *Server) handleSearch(w http.ResponseWriter, r *http.Request) {
eh.Subject = pm.Subject
if !pm.Date.IsZero() {
eh.Date = pm.Date.UTC().Format(time.RFC3339)
} else if t, ok := receivedAts[h.ID]; ok && !t.IsZero() {
eh.Date = t.UTC().Format(time.RFC3339)
}
eh.HasAttachments = len(pm.Attachments) > 0