non ported html fix

This commit is contained in:
Richard Bondi
2021-02-21 21:42:28 -06:00
committed by fiatjaf
parent e6cc6347e2
commit acff24ad46

View File

@@ -1,6 +1,7 @@
package event package event
import ( import (
"bytes"
"crypto/rand" "crypto/rand"
"crypto/sha256" "crypto/sha256"
"encoding/hex" "encoding/hex"
@@ -81,8 +82,12 @@ func (evt *Event) Serialize() []byte {
// content // content
arr[5] = evt.Content arr[5] = evt.Content
serialized, _ := json.Marshal(arr) serialized := new(bytes.Buffer)
return serialized
enc := json.NewEncoder(serialized)
enc.SetEscapeHTML(false)
_ = enc.Encode(arr)
return serialized.Bytes()[:serialized.Len()-1] // Encode add new line char
} }
// CheckSignature checks if the signature is valid for the id // CheckSignature checks if the signature is valid for the id