fix: if the render end is 0, ensure the range header is valid syntax and skip it
This commit is contained in:
parent
f56377df2b
commit
6c60dae743
|
@ -2059,7 +2059,13 @@ func (s *S5API) pinImportCronJob(cid string, url string, proofUrl string, userId
|
||||||
|
|
||||||
upload, err := s.storage.UploadObject(ctx, s5.GetStorageProtocol(s.protocol), nil, &renter.MultiPartUploadParams{
|
upload, err := s.storage.UploadObject(ctx, s5.GetStorageProtocol(s.protocol), nil, &renter.MultiPartUploadParams{
|
||||||
ReaderFactory: func(start uint, end uint) (io.ReadCloser, error) {
|
ReaderFactory: func(start uint, end uint) (io.ReadCloser, error) {
|
||||||
rangeHeader := fmt.Sprintf("bytes=%d-%d", start, end)
|
rangeHeader := "bytes=%d-"
|
||||||
|
if end != 0 {
|
||||||
|
rangeHeader += "%d"
|
||||||
|
rangeHeader = fmt.Sprintf("bytes=%d-%d", start, end)
|
||||||
|
} else {
|
||||||
|
rangeHeader = fmt.Sprintf("bytes=%d-", start)
|
||||||
|
}
|
||||||
object, err := client.GetObject(ctx, &s3.GetObjectInput{
|
object, err := client.GetObject(ctx, &s3.GetObjectInput{
|
||||||
Bucket: aws.String(s.config.Config().Core.Storage.S3.BufferBucket),
|
Bucket: aws.String(s.config.Config().Core.Storage.S3.BufferBucket),
|
||||||
Key: aws.String(cid),
|
Key: aws.String(cid),
|
||||||
|
|
|
@ -390,7 +390,13 @@ func (t *TusHandler) uploadTask(hash []byte) error {
|
||||||
|
|
||||||
uploadMeta, err := t.storage.UploadObject(ctx, t.storageProtocol, nil, &renter.MultiPartUploadParams{
|
uploadMeta, err := t.storage.UploadObject(ctx, t.storageProtocol, nil, &renter.MultiPartUploadParams{
|
||||||
ReaderFactory: func(start uint, end uint) (io.ReadCloser, error) {
|
ReaderFactory: func(start uint, end uint) (io.ReadCloser, error) {
|
||||||
rangeHeader := fmt.Sprintf("bytes=%d-%d", start, end)
|
rangeHeader := "bytes=%d-"
|
||||||
|
if end != 0 {
|
||||||
|
rangeHeader += "%d"
|
||||||
|
rangeHeader = fmt.Sprintf("bytes=%d-%d", start, end)
|
||||||
|
} else {
|
||||||
|
rangeHeader = fmt.Sprintf("bytes=%d-", start)
|
||||||
|
}
|
||||||
ctx = context.WithValue(ctx, "range", rangeHeader)
|
ctx = context.WithValue(ctx, "range", rangeHeader)
|
||||||
return tusUpload.GetReader(ctx)
|
return tusUpload.GetReader(ctx)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue