diff --git a/api/s5/s5.go b/api/s5/s5.go index 5a8e067..7e1b33f 100644 --- a/api/s5/s5.go +++ b/api/s5/s5.go @@ -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{ 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{ Bucket: aws.String(s.config.Config().Core.Storage.S3.BufferBucket), Key: aws.String(cid), diff --git a/protocols/s5/tus.go b/protocols/s5/tus.go index b432571..ff66e59 100644 --- a/protocols/s5/tus.go +++ b/protocols/s5/tus.go @@ -390,7 +390,13 @@ func (t *TusHandler) uploadTask(hash []byte) error { uploadMeta, err := t.storage.UploadObject(ctx, t.storageProtocol, nil, &renter.MultiPartUploadParams{ 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) return tusUpload.GetReader(ctx) },