Skip to content

Commit

Permalink
better regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj committed Apr 26, 2024
1 parent d09a9e8 commit 7166728
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions flow/connectors/utils/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ func FileURLForS3Service(endpoint string, region string, bucket string, filePath
if strings.Contains(endpoint, "storage.googleapis.com") {
fileUrl = fmt.Sprintf("https://storage.googleapis.com/%s/%s", bucket, filePath)
}
// example: min.io local bucket
match, _ := regexp.MatchString(`^http://[a-zA-Z0-9.-]+:\d+$`, endpoint)
// example: min.io local bucket or GCS
match, _ := regexp.MatchString(`^https?://[a-zA-Z0-9.-]+(:\d+)?$`, endpoint)
if match {
fileUrl = fmt.Sprintf("%s/%s/%s", endpoint, bucket, filePath)
}
Expand Down Expand Up @@ -245,7 +245,7 @@ func (r *resolverV2) ResolveEndpoint(ctx context.Context, params s3.EndpointPara
return smithyendpoints.Endpoint{}, err
}

u.Path = "/" + *params.Bucket
u.Path += "/" + *params.Bucket
return smithyendpoints.Endpoint{
URI: *u,
}, nil
Expand Down

0 comments on commit 7166728

Please sign in to comment.