diff --git a/src/aws-cpp-sdk-core/include/aws/core/http/URI.h b/src/aws-cpp-sdk-core/include/aws/core/http/URI.h index 894a57eff07..990bbc065c8 100644 --- a/src/aws-cpp-sdk-core/include/aws/core/http/URI.h +++ b/src/aws-cpp-sdk-core/include/aws/core/http/URI.h @@ -153,7 +153,7 @@ namespace Aws { m_pathSegments.push_back(segment); } - m_pathHasTrailingSlash = (m_pathSegments.empty() || !s_preservePathSeparators) && (!segments.empty() && segments.back() == '/'); + m_pathHasTrailingSlash = !segments.empty() && segments.back() == '/'; } /** diff --git a/tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp b/tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp index 80bc663d3ed..3f9a45aa9ae 100644 --- a/tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp +++ b/tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp @@ -224,30 +224,53 @@ TEST_F(S3UnitTest, S3UriPathPreservationOn) { //Turn on path preservation Aws::Http::SetPreservePathSeparators(true); - auto putObjectRequest = PutObjectRequest() - .WithBucket("velvetunderground") - .WithKey("////stephanie////says////////////that////////she//wants///////to/know.txt"); + struct TestCase { + const char* bucket; + const char* key; + const char* expectedUri; + }; - std::shared_ptr body = Aws::MakeShared(ALLOCATION_TAG, - "What country shall I say is calling From across the world?", - std::ios_base::in | std::ios_base::binary); + TestCase testCases[] = { + { + "velvetunderground", + "////stephanie////says////////////that////////she//wants///////to/know.txt", + "https://velvetunderground.s3.us-east-1.amazonaws.com/////stephanie////says////////////that////////she//wants///////to/know.txt" + }, + { + "velvetunderground", + "////stephanie////says////////////that////////she//wants///////to/know.txt/", + "https://velvetunderground.s3.us-east-1.amazonaws.com/////stephanie////says////////////that////////she//wants///////to/know.txt/" + }, + { + "velvetunderground", + "////stephanie////says////////////that////////she//wants///////to/know.txt//", + "https://velvetunderground.s3.us-east-1.amazonaws.com/////stephanie////says////////////that////////she//wants///////to/know.txt//" + } + }; - putObjectRequest.SetBody(body); + for (const auto& testCase : testCases) { + auto putObjectRequest = PutObjectRequest() + .WithBucket(testCase.bucket) + .WithKey(testCase.key); - //We have to mock requset because it is used to create the return body, it actually isnt used. - auto mockRequest = Aws::MakeShared(ALLOCATION_TAG, "mockuri", HttpMethod::HTTP_GET); - mockRequest->SetResponseStreamFactory([]() -> IOStream* { - return Aws::New(ALLOCATION_TAG, "response-string", std::ios_base::in | std::ios_base::binary); - }); - auto mockResponse = Aws::MakeShared(ALLOCATION_TAG, mockRequest); - mockResponse->SetResponseCode(HttpResponseCode::OK); - _mockHttpClient->AddResponseToReturn(mockResponse); + std::shared_ptr body = Aws::MakeShared(ALLOCATION_TAG, + "test content", std::ios_base::in | std::ios_base::binary); + putObjectRequest.SetBody(body); - const auto response = _s3Client->PutObject(putObjectRequest); - AWS_EXPECT_SUCCESS(response); + auto mockRequest = Aws::MakeShared(ALLOCATION_TAG, "mockuri", HttpMethod::HTTP_GET); + mockRequest->SetResponseStreamFactory([]() -> IOStream* { + return Aws::New(ALLOCATION_TAG, "response-string", std::ios_base::in | std::ios_base::binary); + }); + auto mockResponse = Aws::MakeShared(ALLOCATION_TAG, mockRequest); + mockResponse->SetResponseCode(HttpResponseCode::OK); + _mockHttpClient->AddResponseToReturn(mockResponse); - const auto seenRequest = _mockHttpClient->GetMostRecentHttpRequest(); - EXPECT_EQ("https://velvetunderground.s3.us-east-1.amazonaws.com/////stephanie////says////////////that////////she//wants///////to/know.txt", seenRequest.GetUri().GetURIString()); + const auto response = _s3Client->PutObject(putObjectRequest); + AWS_EXPECT_SUCCESS(response); + + const auto seenRequest = _mockHttpClient->GetMostRecentHttpRequest(); + EXPECT_EQ(testCase.expectedUri, seenRequest.GetUri().GetURIString()); + } } TEST_F(S3UnitTest, S3EmbeddedErrorTest) { diff --git a/tools/scripts/run_integration_tests.py b/tools/scripts/run_integration_tests.py index 5627fc35f55..cb46a95463f 100644 --- a/tools/scripts/run_integration_tests.py +++ b/tools/scripts/run_integration_tests.py @@ -44,6 +44,7 @@ def main(): "aws-cpp-sdk-dynamodb-integration-tests", "aws-cpp-sdk-sqs-integration-tests", "aws-cpp-sdk-sqs-unit-tests", + "aws-cpp-sdk-sns-integration-tests", "aws-cpp-sdk-s3-integration-tests", "aws-cpp-sdk-s3-unit-tests", "aws-cpp-sdk-s3-crt-integration-tests",