Rename WithContentID to WithFileContentID

In the eml.go and file.go files, the function WithContentID has been renamed to WithFileContentID. This aligns more accurately with the function purpose, which is to set the content ID for a File object.
This commit is contained in:
Winni Neessen 2024-06-28 13:49:21 +02:00
parent ca201b1548
commit 4e7082a540
Signed by: wneessen
GPG key ID: 385AC9889632126E
2 changed files with 3 additions and 3 deletions

2
eml.go
View file

@ -405,7 +405,7 @@ func parseEMLAttachmentEmbed(contentDisposition []string, multiPart *multipart.P
} }
case "inline": case "inline":
if contentID, _ := parseMultiPartHeader(multiPart.Header.Get(HeaderContentID.String())); contentID != "" { if contentID, _ := parseMultiPartHeader(multiPart.Header.Get(HeaderContentID.String())); contentID != "" {
if err := msg.EmbedReader(filename, dataReader, WithContentID(contentID)); err != nil { if err := msg.EmbedReader(filename, dataReader, WithFileContentID(contentID)); err != nil {
return fmt.Errorf("failed to embed multipart body: %w", err) return fmt.Errorf("failed to embed multipart body: %w", err)
} }
return nil return nil

View file

@ -22,8 +22,8 @@ type File struct {
Writer func(w io.Writer) (int64, error) Writer func(w io.Writer) (int64, error)
} }
// WithContentID sets the Content-ID header for the File // WithFileContentID sets the Content-ID header for the File
func WithContentID(id string) FileOption { func WithFileContentID(id string) FileOption {
return func(f *File) { return func(f *File) {
f.Header.Set(HeaderContentID.String(), id) f.Header.Set(HeaderContentID.String(), id)
} }