Merge pull request #74 from harshavardhana/pr_out_now_cp_works_properly_with_amazons3
This commit is contained in:
+5
-4
@@ -86,12 +86,13 @@ func (c *Client) bucketURL(bucket string) string {
|
||||
if !c.S3ForcePathStyle {
|
||||
if IsValidBucket(bucket) && !strings.Contains(bucket, ".") {
|
||||
var url_ string
|
||||
if strings.Contains(c.endpoint(), "amazonaws.com") {
|
||||
url_ = fmt.Sprintf("https://%s.%s/", bucket, strings.TrimPrefix(c.endpoint(), "https://"))
|
||||
} else if strings.Contains(c.endpoint(), "localhost") || strings.Contains(bucket, "127.0.0.1") {
|
||||
// if localhost forcePathStyle
|
||||
if strings.Contains(c.endpoint(), "localhost") || strings.Contains(bucket, "127.0.0.1") {
|
||||
url_ = fmt.Sprintf("%s/%s", c.endpoint(), bucket)
|
||||
} else if strings.Contains(c.endpoint(), "amazonaws.com") {
|
||||
url_ = fmt.Sprintf("https://%s.%s", bucket, strings.TrimPrefix(c.endpoint(), "https://"))
|
||||
} else {
|
||||
url_ = fmt.Sprintf("http://%s.%s/", bucket, strings.TrimPrefix(c.endpoint(), "http://"))
|
||||
url_ = fmt.Sprintf("http://%s.%s", bucket, strings.TrimPrefix(c.endpoint(), "http://"))
|
||||
}
|
||||
return url_
|
||||
}
|
||||
|
||||
+2
-2
@@ -121,13 +121,13 @@ func doFsCopy(c *cli.Context) {
|
||||
} else if fsoptions.isget {
|
||||
var objectReader io.ReadCloser
|
||||
var objectSize int64
|
||||
bodyFile, err = os.Create(fsoptions.body)
|
||||
defer bodyFile.Close()
|
||||
|
||||
objectReader, objectSize, err = s3c.Get(fsoptions.bucket, fsoptions.key)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
bodyFile, err = os.Create(fsoptions.body)
|
||||
defer bodyFile.Close()
|
||||
|
||||
// start progress bar
|
||||
bar := startBar(objectSize)
|
||||
|
||||
Reference in New Issue
Block a user