Fix calculating avatar Base64

calls
Bohdan Horbeshko 2 years ago
parent 493c49cde5
commit 3a43c6223f

@ -258,11 +258,12 @@ func handleGetVcardTempIq(s xmpp.Sender, iq *stanza.IQ) {
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
binval := base64.NewEncoder(base64.StdEncoding, buf) binval := base64.NewEncoder(base64.StdEncoding, buf)
_, err = io.Copy(binval, file) _, err = io.Copy(binval, file)
binval.Close()
if err == nil { if err == nil {
vcard.Photo.Type.Text = "image/jpeg" vcard.Photo.Type.Text = "image/jpeg"
vcard.Photo.Binval.Text = buf.String() vcard.Photo.Binval.Text = buf.String()
} else { } else {
log.Errorf("Error calculating hash: %v", path) log.Errorf("Error calculating base64: %v", path)
} }
} else if path != "" { } else if path != "" {
log.Errorf("Photo does not exist: %v", path) log.Errorf("Photo does not exist: %v", path)

Loading…
Cancel
Save