Skip to content

Commit 8f40b9f

Browse files
committed
fix size calc
1 parent b8c3640 commit 8f40b9f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/mailer/mail.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ func (b64embedder *mailAttachmentBase64Embedder) AttachmentSrcToBase64DataURI(ct
131131
if attachment.Size+b64embedder.estimateSize > b64embedder.maxSize {
132132
return "", fmt.Errorf("total embedded images exceed max limit")
133133
}
134-
b64embedder.estimateSize += attachment.Size
135134

136135
fr, err := storage.Attachments.Open(attachment.RelativePath())
137136
if err != nil {
@@ -152,6 +151,7 @@ func (b64embedder *mailAttachmentBase64Embedder) AttachmentSrcToBase64DataURI(ct
152151

153152
encoded := base64.StdEncoding.EncodeToString(content)
154153
dataURI := fmt.Sprintf("data:%s;base64,%s", mimeType.GetMimeType(), encoded)
154+
b64embedder.estimateSize += int64(len(dataURI))
155155
return dataURI, nil
156156
}
157157

0 commit comments

Comments
 (0)