fix length checks from previous commit.
This commit is contained in:
@@ -28,12 +28,12 @@ func easyjsonDecodeEvent(in *jlexer.Lexer, out *Event) {
|
|||||||
switch key {
|
switch key {
|
||||||
case "id":
|
case "id":
|
||||||
b := in.UnsafeBytes()
|
b := in.UnsafeBytes()
|
||||||
if len(b) == 32 {
|
if len(b) == 64 {
|
||||||
hex.Decode(out.ID[:], b)
|
hex.Decode(out.ID[:], b)
|
||||||
}
|
}
|
||||||
case "pubkey":
|
case "pubkey":
|
||||||
b := in.UnsafeBytes()
|
b := in.UnsafeBytes()
|
||||||
if len(b) == 32 {
|
if len(b) == 64 {
|
||||||
hex.Decode(out.PubKey[:], b)
|
hex.Decode(out.PubKey[:], b)
|
||||||
}
|
}
|
||||||
case "created_at":
|
case "created_at":
|
||||||
@@ -72,7 +72,7 @@ func easyjsonDecodeEvent(in *jlexer.Lexer, out *Event) {
|
|||||||
out.Content = in.String()
|
out.Content = in.String()
|
||||||
case "sig":
|
case "sig":
|
||||||
b := in.UnsafeBytes()
|
b := in.UnsafeBytes()
|
||||||
if len(b) == 64 {
|
if len(b) == 128 {
|
||||||
hex.Decode(out.Sig[:], b)
|
hex.Decode(out.Sig[:], b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ func easyjsonDecodeFilter(in *jlexer.Lexer, out *Filter) {
|
|||||||
for !in.IsDelim(']') {
|
for !in.IsDelim(']') {
|
||||||
id := [32]byte{}
|
id := [32]byte{}
|
||||||
b := in.UnsafeBytes()
|
b := in.UnsafeBytes()
|
||||||
if len(b) == 32 {
|
if len(b) == 64 {
|
||||||
hex.Decode(id[:], b)
|
hex.Decode(id[:], b)
|
||||||
}
|
}
|
||||||
out.IDs = append(out.IDs, id)
|
out.IDs = append(out.IDs, id)
|
||||||
@@ -78,7 +78,7 @@ func easyjsonDecodeFilter(in *jlexer.Lexer, out *Filter) {
|
|||||||
for !in.IsDelim(']') {
|
for !in.IsDelim(']') {
|
||||||
pk := [32]byte{}
|
pk := [32]byte{}
|
||||||
b := in.UnsafeBytes()
|
b := in.UnsafeBytes()
|
||||||
if len(b) == 32 {
|
if len(b) == 64 {
|
||||||
hex.Decode(pk[:], b)
|
hex.Decode(pk[:], b)
|
||||||
}
|
}
|
||||||
out.Authors = append(out.Authors, pk)
|
out.Authors = append(out.Authors, pk)
|
||||||
|
|||||||
Reference in New Issue
Block a user