handle range with no limit

This commit is contained in:
Andrea Spacca 2023-02-11 11:47:51 +09:00
parent 158e5487ee
commit 2a29083960
1 changed files with 3 additions and 1 deletions

View File

@ -86,7 +86,9 @@ func (s *StorjStorage) Get(ctx context.Context, token string, filename string, r
options := uplink.DownloadOptions{}
if rng != nil {
options.Offset = int64(rng.Start)
options.Length = int64(rng.Limit)
if rng.Limit > 0 {
options.Length = int64(rng.Limit)
}
}
download, err := s.project.DownloadObject(fpath.WithTempData(ctx, "", true), s.bucket.Name, key, &options)