satellite/metainfo: check if EncryptedMetadataNonce was set

It possible that old uplinks won't set it.

Change-Id: Ifd3c4d4a45c5636cfeb70b0a37bcf1305a097727
This commit is contained in:
Michal Niewrzal 2020-11-18 14:00:28 +01:00
parent a30f5d7ec0
commit 70b1c7aa17

View File

@ -857,10 +857,13 @@ func (endpoint *Endpoint) getObject(ctx context.Context, projectID uuid.UUID, bu
expires = *metaObject.ExpiresAt
}
nonce, err := storj.NonceFromBytes(metaObject.EncryptedMetadataNonce)
if err != nil {
endpoint.log.Error("internal", zap.Error(err))
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
var nonce storj.Nonce
if len(metaObject.EncryptedMetadataNonce) > 0 {
nonce, err = storj.NonceFromBytes(metaObject.EncryptedMetadataNonce)
if err != nil {
endpoint.log.Error("internal", zap.Error(err))
return nil, rpcstatus.Error(rpcstatus.Internal, err.Error())
}
}
streamMeta := &pb.StreamMeta{}