refactor: optimize file content encoding in NewAttachmentFromFileContent
All checks were successful
🚀 Publish Release Package / publish (push) Successful in 21s

This commit is contained in:
2025-06-25 13:25:18 -04:00
parent 26f309937b
commit cf07508309

View File

@@ -7,11 +7,12 @@ import (
)
func NewAttachmentFromFileContent(fileName string, f []byte) (*FileAttachment, error) {
base64.StdEncoding.Encode(f, f)
buffer := make([]byte, base64.StdEncoding.EncodedLen(len(f)))
base64.StdEncoding.Encode(buffer, f)
return &FileAttachment{
Filename: fileName,
Content: string(f),
Content: string(buffer),
}, nil
}