fix: when we have a proof, the body also has a metadata type byte that needs to be validated
This commit is contained in:
parent
f350a37e58
commit
28ff1eed48
|
@ -152,7 +152,18 @@ func (m *MediaMetadata) decodeProof(dec *msgpack.Decoder) error {
|
|||
|
||||
m.provenPubKeys = provenPubKeys
|
||||
|
||||
return m.decodeMedia(msgpack.NewDecoder(bytes.NewReader(bodyBytes)))
|
||||
mediaDec := msgpack.NewDecoder(bytes.NewReader(bodyBytes))
|
||||
|
||||
mediaByte, err := mediaDec.DecodeUint8()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if types.MetadataType(mediaByte) != types.MetadataTypeMedia {
|
||||
return errors.New("Invalid metadata type")
|
||||
}
|
||||
|
||||
return m.decodeMedia(mediaDec)
|
||||
}
|
||||
|
||||
func (m *MediaMetadata) decodeMedia(dec *msgpack.Decoder) error {
|
||||
|
|
Loading…
Reference in New Issue