aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2022-06-25 23:58:36 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2022-06-25 23:58:36 +0300
commit3a43c6223f7f4f21dda0a484ef3ec858102c836c (patch)
tree337ce8e52c02facb41b49a0a06322240119ebfda
parent493c49cde5b5d51f3dd9bc6b1a925b0fd2a1c52f (diff)
Fix calculating avatar Base64
-rw-r--r--xmpp/handlers.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/xmpp/handlers.go b/xmpp/handlers.go
index ee1db21..870a292 100644
--- a/xmpp/handlers.go
+++ b/xmpp/handlers.go
@@ -258,11 +258,12 @@ func handleGetVcardTempIq(s xmpp.Sender, iq *stanza.IQ) {
buf := new(bytes.Buffer)
binval := base64.NewEncoder(base64.StdEncoding, buf)
_, err = io.Copy(binval, file)
+ binval.Close()
if err == nil {
vcard.Photo.Type.Text = "image/jpeg"
vcard.Photo.Binval.Text = buf.String()
} else {
- log.Errorf("Error calculating hash: %v", path)
+ log.Errorf("Error calculating base64: %v", path)
}
} else if path != "" {
log.Errorf("Photo does not exist: %v", path)