@@ -33,12 +33,17 @@ namespace S3
3333URI::URI (const std::string & uri_)
3434{
3535 // / Case when bucket name represented in domain name of S3 URL.
36- // / E.g. (https://bucket-name.s3.Region .amazonaws.com/key)
36+ // / E.g. (https://bucket-name.s3.region .amazonaws.com/key)
3737 // / https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#virtual-hosted-style-access
3838 static const RE2 virtual_hosted_style_pattern (R"( (.+)\.(s3express[\-a-z0-9]+|s3|cos|obs|oss|eos)([.\-][a-z0-9\-.:]+))" );
3939
40+ // / Case when AWS Private Link Interface is being used
41+ // / E.g. (bucket.vpce-07a1cd78f1bd55c5f-j3a3vg6w.s3.us-east-1.vpce.amazonaws.com/bucket-name/key)
42+ // / https://docs.aws.amazon.com/AmazonS3/latest/userguide/privatelink-interface-endpoints.html
43+ static const RE2 aws_private_link_style_pattern (R"( bucket\.vpce\-([a-z0-9\-.]+)\.vpce.amazonaws.com(:\d{1,5})?)" );
44+
4045 // / Case when bucket name and key represented in path of S3 URL.
41- // / E.g. (https://s3.Region .amazonaws.com/bucket-name/key)
46+ // / E.g. (https://s3.region .amazonaws.com/bucket-name/key)
4247 // / https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#path-style-access
4348 static const RE2 path_style_pattern (" ^/([^/]*)/(.*)" );
4449
@@ -103,7 +108,10 @@ URI::URI(const std::string & uri_)
103108 String name;
104109 String endpoint_authority_from_uri;
105110
106- if (re2::RE2::FullMatch (uri.getAuthority (), virtual_hosted_style_pattern, &bucket, &name, &endpoint_authority_from_uri))
111+ bool is_using_aws_private_link_interface = re2::RE2::FullMatch (uri.getAuthority (), aws_private_link_style_pattern);
112+
113+ if (!is_using_aws_private_link_interface
114+ && re2::RE2::FullMatch (uri.getAuthority (), virtual_hosted_style_pattern, &bucket, &name, &endpoint_authority_from_uri))
107115 {
108116 is_virtual_hosted_style = true ;
109117 endpoint = uri.getScheme () + " ://" + name + endpoint_authority_from_uri;
0 commit comments