From 3a43c6223f7f4f21dda0a484ef3ec858102c836c Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Sat, 25 Jun 2022 16:58:36 -0400 Subject: [PATCH] Fix calculating avatar Base64 --- xmpp/handlers.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)