Merge pull request #2354 from ebriand/fix-aws-push

Fix AWS push
This commit is contained in:
Justin Cormack 2017-08-04 11:22:27 +01:00 committed by GitHub
commit 305aa129d2

View File

@ -4,7 +4,6 @@ import (
"context" "context"
"flag" "flag"
"fmt" "fmt"
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -69,9 +68,9 @@ func pushAWS(args []string) {
name = filepath.Base(name) name = filepath.Base(name)
} }
content, err := ioutil.ReadAll(f) fi, err := f.Stat()
if err != nil { if err != nil {
log.Fatalf("Error reading file: %v", err) log.Fatalf("Error reading file information: %v", err)
} }
dst := name + filepath.Ext(path) dst := name + filepath.Ext(path)
@ -79,7 +78,7 @@ func pushAWS(args []string) {
Bucket: aws.String(bucket), Bucket: aws.String(bucket),
Key: aws.String(dst), Key: aws.String(dst),
Body: f, Body: f,
ContentLength: aws.Int64(int64(len(content))), ContentLength: aws.Int64(fi.Size()),
ContentType: aws.String("application/octet-stream"), ContentType: aws.String("application/octet-stream"),
} }
log.Debugf("PutObject:\n%v", putParams) log.Debugf("PutObject:\n%v", putParams)