From 4941166848f989ab4ff9a4c3300bb6c38c747443 Mon Sep 17 00:00:00 2001 From: Nate Maninger Date: Wed, 29 Nov 2023 22:41:32 -0800 Subject: [PATCH] sia: use bucket field for proxied downloads, set bucket field for uploads --- sia/sia.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sia/sia.go b/sia/sia.go index d6898d1..d086c97 100644 --- a/sia/sia.go +++ b/sia/sia.go @@ -154,9 +154,11 @@ func (n *Node) UploadFile(ctx context.Context, r io.Reader, opts UnixFSOptions) // get the blocks from the dag service blocks := dagSvc.Blocks() - // set the object keys for the blocks + // set the renterd bucket and object key for the blocks for i := range blocks { + blocks[i].Data.Bucket = n.renterd.Bucket blocks[i].Data.Key = dataKey + blocks[i].Metadata.Bucket = n.renterd.Bucket blocks[i].Metadata.Key = metaKey } @@ -188,7 +190,7 @@ func (n *Node) ProxyHTTPDownload(c cid.Cid, r *http.Request, w http.ResponseWrit panic(err) } target.RawQuery = url.Values{ - "bucket": []string{n.renterd.Bucket}, + "bucket": []string{block.Data.Bucket}, }.Encode() rp := &httputil.ReverseProxy{