Skip to content

Commit a8e8771

Browse files
authored
Merge pull request #60 from nicon89/feature/allow_gcloud_bucket_with_path
Adding fileName to gcloud command to allow usage of bucket name with path
2 parents 8b59140 + c54c649 commit a8e8771

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/backup/gcloud.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package backup
22

33
import (
44
"fmt"
5+
"path/filepath"
56
"strings"
67
"time"
78

@@ -22,8 +23,10 @@ func gCloudUpload(file string, plan config.Plan) (string, error) {
2223
}
2324
}
2425

25-
upload := fmt.Sprintf("gsutil cp %v gs://%v",
26-
file, plan.GCloud.Bucket)
26+
fileName := filepath.Base(file)
27+
28+
upload := fmt.Sprintf("gsutil cp %v gs://%v/%v",
29+
file, plan.GCloud.Bucket, fileName)
2730

2831
result, err := sh.Command("/bin/sh", "-c", upload).SetTimeout(time.Duration(plan.Scheduler.Timeout) * time.Minute).CombinedOutput()
2932
output := ""

0 commit comments

Comments
 (0)