MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / AttachmentAt

Function AttachmentAt

internal/mailparse/attachments.go:55–61  ·  view source on GitHub ↗

AttachmentAt returns the attachment at the 0-based index, or false if out of range. It re-walks the message (the caller holds the raw bytes); attachments are typically few, so a per-call walk is fine.

(raw []byte, index int)

Source from the content-addressed store, hash-verified

53// range. It re-walks the message (the caller holds the raw bytes); attachments
54// are typically few, so a per-call walk is fine.
55func AttachmentAt(raw []byte, index int) (Attachment, bool) {
56 atts := Attachments(raw)
57 if index < 0 || index >= len(atts) {
58 return Attachment{}, false
59 }
60 return atts[index], true
61}
62
63// collectAttachments appends attachment leaves found under this part to *out.
64func collectAttachments(contentType, cte, disposition, partFilename string, body io.Reader, depth int, out *[]Attachment) {

Callers 3

handleGetAttachmentMethod · 0.92
TestAttachmentAt_BoundsFunction · 0.85

Calls 1

AttachmentsFunction · 0.85

Tested by 1

TestAttachmentAt_BoundsFunction · 0.68