Attachment fixes to address inconsistencies between DB and backend store

This commit is contained in:
binwiederhier
2026-03-24 17:37:50 -04:00
parent dd760f16f7
commit e55d1cee6b
6 changed files with 69 additions and 36 deletions
+3
View File
@@ -1426,6 +1426,9 @@ func (s *Server) handleBodyAsAttachment(r *http.Request, v *visitor, m *model.Me
return err
}
attachmentExpiry := time.Now().Add(vinfo.Limits.AttachmentExpiryDuration).Unix()
if m.Expires > 0 && attachmentExpiry > m.Expires {
attachmentExpiry = m.Expires // Attachment must never outlive the message
}
if m.Time > attachmentExpiry {
return errHTTPBadRequestAttachmentsExpiryBeforeDelivery.With(m)
}