Skip to content

Commit 464769a

Browse files
committed
need to json.unmarshal data_base64
Signed-off-by: Doug Davis <[email protected]>
1 parent d834326 commit 464769a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

v2/event/event_unmarshal.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package event
77

88
import (
99
"encoding/base64"
10+
"encoding/json"
1011
"errors"
1112
"fmt"
1213
"io"
@@ -385,9 +386,13 @@ func consumeData(e *Event, isBase64 bool, iter *jsoniter.Iterator) error {
385386
e.DataBase64 = true
386387

387388
// Allocate payload byte buffer
388-
base64Encoded := iter.ReadStringAsSlice()
389+
base64Encoded := iter.ReadString()
390+
err := json.Unmarshal([]byte(`"`+string(base64Encoded)+`"`), &base64Encoded)
391+
if err != nil {
392+
return err
393+
}
389394
e.DataEncoded = make([]byte, base64.StdEncoding.DecodedLen(len(base64Encoded)))
390-
length, err := base64.StdEncoding.Decode(e.DataEncoded, base64Encoded)
395+
length, err := base64.StdEncoding.Decode(e.DataEncoded, []byte(base64Encoded))
391396
if err != nil {
392397
return err
393398
}

0 commit comments

Comments
 (0)