refactor: have the forward slash always prefixed at the renter abstraction

This commit is contained in:
Derrick Hammer 2024-02-18 03:30:42 -05:00
parent ca289818a9
commit 901c68fdfc
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 5 additions and 1 deletions

View File

@ -395,7 +395,7 @@ func (t *TusHandler) uploadTask(hash []byte) error {
return tusUpload.GetReader(ctx)
},
Bucket: upload.Protocol,
FileName: "/" + t.storageProtocol.EncodeFileName(upload.Hash),
FileName: t.storageProtocol.EncodeFileName(upload.Hash),
Size: uint64(info.Size),
}, proof)

View File

@ -8,6 +8,7 @@ import (
"math"
"net/url"
"strconv"
"strings"
"git.lumeweb.com/LumeWeb/portal/cron"
"github.com/google/uuid"
@ -89,6 +90,7 @@ func (r *RenterDefault) CreateBucketIfNotExists(bucket string) error {
}
func (r *RenterDefault) UploadObject(ctx context.Context, file io.Reader, bucket string, fileName string) error {
fileName = "/" + strings.TrimLeft(fileName, "/")
_, err := r.workerClient.UploadObject(ctx, file, bucket, fileName, api.UploadObjectOptions{})
if err != nil {
@ -140,6 +142,8 @@ func (r *RenterDefault) UploadObjectMultipart(ctx context.Context, params *Multi
fileName := params.FileName
idHandler := params.UploadIDHandler
fileName = "/" + strings.TrimLeft(fileName, "/")
var redundancy api.RedundancySettings
err := r.GetSetting(ctx, "redundancy", &redundancy)