refactor: optimize file content encoding in NewAttachmentFromFileContent
All checks were successful
🚀 Publish Release Package / publish (push) Successful in 21s
All checks were successful
🚀 Publish Release Package / publish (push) Successful in 21s
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user