backend/oss: Fixes the nil pointer panic error when missing access key or secret key

This commit is contained in:
xiaozhu36 2021-10-20 16:05:00 +08:00
parent cdd5ee6fb3
commit 7afaea4cf2
1 changed files with 4 additions and 1 deletions

View File

@ -319,7 +319,10 @@ func (b *Backend) configure(ctx context.Context) error {
}
if endpoint == "" {
endpointsResponse, _ := b.getOSSEndpointByRegion(accessKey, secretKey, securityToken, region)
endpointsResponse, err := b.getOSSEndpointByRegion(accessKey, secretKey, securityToken, region)
if err != nil {
return err
}
for _, endpointItem := range endpointsResponse.Endpoints.Endpoint {
if endpointItem.Type == "openAPI" {
endpoint = endpointItem.Endpoint