Skip to content

Instantly share code, notes, and snippets.

@krobertson
Created November 2, 2015 20:07
Show Gist options
  • Save krobertson/cf985ed98b9bfb0bd0fa to your computer and use it in GitHub Desktop.
Save krobertson/cf985ed98b9bfb0bd0fa to your computer and use it in GitHub Desktop.
From e26d0d62248a6245ee5b204595dadd9b047d9192 Mon Sep 17 00:00:00 2001
From: Ken Robertson <ken@invalidlogic.com>
Date: Mon, 2 Nov 2015 12:06:56 -0800
Subject: [PATCH] blarg
---
.../aws/aws-sdk-go/service/s3/s3manager/download.go | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go
index 39825cf..d917bab 100644
--- a/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go
+++ b/Godeps/_workspace/src/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go
@@ -203,14 +203,20 @@ func (d *downloader) setTotalBytes(resp *s3.GetObjectOutput) {
return
}
- parts := strings.Split(*resp.ContentRange, "/")
- total, err := strconv.ParseInt(parts[len(parts)-1], 10, 64)
- if err != nil {
- d.err = err
+ if resp.ContentRange != nil {
+ parts := strings.Split(*resp.ContentRange, "/")
+ total, err := strconv.ParseInt(parts[len(parts)-1], 10, 64)
+ if err != nil {
+ d.err = err
+ return
+ }
+ d.totalBytes = total
return
}
- d.totalBytes = total
+ if resp.ContentLength != nil {
+ d.totalBytes = *resp.ContentLength
+ }
}
func (d *downloader) incrwritten(n int64) {
--
2.6.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment