File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -46,12 +46,17 @@ func OpenS3(s3args []string) string {
4646 log .WithFields (
4747 log.Fields {
4848 "s3args" : s3args ,
49- "str" : str ,
49+ "str" : str ,
5050 }).Debug ()
5151 if len (str ) > 1 {
52- // objects
52+ if str [1 ][len (str [1 ])- 1 :len (str [1 ])] == "/" {
53+ // buckets
54+ u .Path += "buckets/" + str [0 ]
55+ } else {
56+ // objects
57+ u .Path += "object/" + str [0 ]
58+ }
5359 q .Set ("prefix" , str [1 ])
54- u .Path += "object/" + str [0 ]
5560 } else {
5661 // buckets
5762 u .Path += "buckets/" + str [0 ]
Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ func TestOpenS3(t *testing.T) {
3333 input : []string {"cf-templates-xxxxxxxxx-ap-northeast-1" , "permissions" },
3434 want : "https://s3.console.aws.amazon.com/s3/buckets/cf-templates-xxxxxxxxx-ap-northeast-1?tab=permissions" ,
3535 },
36+ {
37+ input : []string {"cf-templates-xxxxxxxxx-ap-northeast-1/2021/01/01/" },
38+ want : "https://s3.console.aws.amazon.com/s3/buckets/cf-templates-xxxxxxxxx-ap-northeast-1?prefix=2021%2F01%2F01%2F" ,
39+ },
3640 }
3741
3842 for _ , v := range a {
You can’t perform that action at this time.
0 commit comments