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)
|
return tusUpload.GetReader(ctx)
|
||||||
},
|
},
|
||||||
Bucket: upload.Protocol,
|
Bucket: upload.Protocol,
|
||||||
FileName: "/" + t.storageProtocol.EncodeFileName(upload.Hash),
|
FileName: t.storageProtocol.EncodeFileName(upload.Hash),
|
||||||
Size: uint64(info.Size),
|
Size: uint64(info.Size),
|
||||||
}, proof)
|
}, proof)
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"git.lumeweb.com/LumeWeb/portal/cron"
|
"git.lumeweb.com/LumeWeb/portal/cron"
|
||||||
"github.com/google/uuid"
|
"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 {
|
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{})
|
_, err := r.workerClient.UploadObject(ctx, file, bucket, fileName, api.UploadObjectOptions{})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -140,6 +142,8 @@ func (r *RenterDefault) UploadObjectMultipart(ctx context.Context, params *Multi
|
||||||
fileName := params.FileName
|
fileName := params.FileName
|
||||||
idHandler := params.UploadIDHandler
|
idHandler := params.UploadIDHandler
|
||||||
|
|
||||||
|
fileName = "/" + strings.TrimLeft(fileName, "/")
|
||||||
|
|
||||||
var redundancy api.RedundancySettings
|
var redundancy api.RedundancySettings
|
||||||
|
|
||||||
err := r.GetSetting(ctx, "redundancy", &redundancy)
|
err := r.GetSetting(ctx, "redundancy", &redundancy)
|
||||||
|
|
Loading…
Reference in New Issue