Skip to content

Commit

Permalink
cherry pick pingcap#30530 to release-5.2
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
  • Loading branch information
tongtongyin authored and ti-srebot committed Dec 20, 2021
1 parent ae76eac commit a848fbe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion br/pkg/storage/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (r *testStorageSuite) TestCreateStorage(c *C) {
c.Assert(s3, NotNil)
c.Assert(s3.Bucket, Equals, "bucket2")
c.Assert(s3.Prefix, Equals, "prefix")
c.Assert(s3.Endpoint, Equals, "https://s3.example.com/")
c.Assert(s3.Endpoint, Equals, "https://s3.example.com")
c.Assert(s3.ForcePathStyle, IsFalse)

// nolint:lll
Expand Down
3 changes: 2 additions & 1 deletion br/pkg/storage/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (options *S3BackendOptions) Apply(s3 *backuppb.S3) error {
return errors.Annotate(berrors.ErrStorageInvalidConfig, "secret_access_key not found")
}

s3.Endpoint = options.Endpoint
s3.Endpoint = strings.TrimSuffix(options.Endpoint, "/")
s3.Region = options.Region
// StorageClass, SSE and ACL are acceptable to be empty
s3.StorageClass = options.StorageClass
Expand Down Expand Up @@ -189,6 +189,7 @@ func (options *S3BackendOptions) parseFromFlags(flags *pflag.FlagSet) error {
if err != nil {
return errors.Trace(err)
}
options.Endpoint = strings.TrimSuffix(options.Endpoint, "/")
options.Region, err = flags.GetString(s3RegionOption)
if err != nil {
return errors.Trace(err)
Expand Down

0 comments on commit a848fbe

Please sign in to comment.