Fix test (looks like it was incorrect)

This commit is contained in:
Alexey Milovidov 2020-05-24 13:42:13 +03:00
parent aa8f385085
commit e3cd085230
2 changed files with 3 additions and 2 deletions

View File

@ -111,7 +111,7 @@ namespace S3
if (!client_configuration.endpointOverride.empty()) if (!client_configuration.endpointOverride.empty())
{ {
static const RE2 region_pattern(R"(s3[.\-]([a-z0-9\-]+)\.amazonaws\.)"); static const RE2 region_pattern(R"(^s3[.\-]([a-z0-9\-]+)\.amazonaws\.)");
Poco::URI uri(client_configuration.endpointOverride); Poco::URI uri(client_configuration.endpointOverride);
if (uri.getScheme() == "http") if (uri.getScheme() == "http")
client_configuration.scheme = Aws::Http::Scheme::HTTP; client_configuration.scheme = Aws::Http::Scheme::HTTP;
@ -138,6 +138,7 @@ namespace S3
/// E.g. (https://bucket-name.s3.Region.amazonaws.com/key) /// E.g. (https://bucket-name.s3.Region.amazonaws.com/key)
/// https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#virtual-hosted-style-access /// https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#virtual-hosted-style-access
static const RE2 virtual_hosted_style_pattern(R"((.+)\.(s3[.\-][a-z0-9\-.:]+))"); static const RE2 virtual_hosted_style_pattern(R"((.+)\.(s3[.\-][a-z0-9\-.:]+))");
/// Case when bucket name and key represented in path of S3 URL. /// Case when bucket name and key represented in path of S3 URL.
/// E.g. (https://s3.Region.amazonaws.com/bucket-name/key) /// E.g. (https://s3.Region.amazonaws.com/bucket-name/key)
/// https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#path-style-access /// https://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#path-style-access

View File

@ -17,7 +17,7 @@ TEST(S3UriTest, validPatterns)
{ {
{ {
S3::URI uri(Poco::URI("https://jokserfn.s3.yandexcloud.net/data")); S3::URI uri(Poco::URI("https://jokserfn.s3.yandexcloud.net/data"));
ASSERT_EQ("https://jokserfn.s3.yandexcloud.net", uri.endpoint); ASSERT_EQ("https://s3.yandexcloud.net", uri.endpoint);
ASSERT_EQ("jokserfn", uri.bucket); ASSERT_EQ("jokserfn", uri.bucket);
ASSERT_EQ("data", uri.key); ASSERT_EQ("data", uri.key);
} }