From a20b79ff9045d787c635870fe1476cb6bd87cd89 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 17 Feb 2024 22:59:34 -0500 Subject: [PATCH] fix: forgot to return UploadMetadata --- storage/storage.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/storage/storage.go b/storage/storage.go index 81b7613..34e5bc7 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -171,6 +171,13 @@ func (s StorageServiceDefault) UploadObject(ctx context.Context, protocol Storag return nil, err } + uploadMeta := &metadata.UploadMetadata{ + Protocol: protocolName, + Hash: proof.Hash, + MimeType: mimeType, + Size: uint64(proof.Length), + } + if muParams != nil { muParams.FileName = filename muParams.Bucket = protocolName @@ -180,12 +187,7 @@ func (s StorageServiceDefault) UploadObject(ctx context.Context, protocol Storag return nil, err } - return &metadata.UploadMetadata{ - Protocol: protocolName, - Hash: proof.Hash, - MimeType: mimeType, - Size: uint64(proof.Length), - }, nil + return uploadMeta, nil } err = s.renter.UploadObject(ctx, reader, protocolName, filename) @@ -193,7 +195,7 @@ func (s StorageServiceDefault) UploadObject(ctx context.Context, protocol Storag return nil, err } - return nil, nil + return uploadMeta, nil } func (s StorageServiceDefault) UploadObjectProof(ctx context.Context, protocol StorageProtocol, data io.ReadSeeker, proof *bao.Result) error {