refactor: have the forward slash always prefixed at the renter abstraction
This commit is contained in:
parent
ca289818a9
commit
901c68fdfc
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue