diff --git a/src/deploy.go b/src/deploy.go index e6d93c9..0484a9f 100644 --- a/src/deploy.go +++ b/src/deploy.go @@ -130,11 +130,10 @@ func uploadFile(bucket *s3.Bucket, reader io.Reader, dest string, includeHash bo } log.Printf("Uploading to %s in %s (%s) [%d]\n", dest, bucket.Name, hashPrefix, caching) - op := func() error { - // Copy the buffer so subsequent calls have something to read - buf := buffer - return bucket.PutReader(dest, buf, int64(len(data)), guessContentType(dest)+"; charset=utf-8", s3.PublicRead, s3Opts) + op := func() error { + // We need to create a new reader each time, as we might be doing this more than once (if it fails) + return bucket.PutReader(dest, bytes.NewReader(data), int64(len(data)), guessContentType(dest)+"; charset=utf-8", s3.PublicRead, s3Opts) } back := backoff.NewExponentialBackOff()