Skip to content

Commit 9c2fa10

Browse files
committed
fix/when s_preservePathSeparators enabled
1 parent 994384c commit 9c2fa10

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/aws-cpp-sdk-core/include/aws/core/http/URI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ namespace Aws
153153
{
154154
m_pathSegments.push_back(segment);
155155
}
156-
m_pathHasTrailingSlash = (m_pathSegments.empty() || !s_preservePathSeparators) && (!segments.empty() && segments.back() == '/');
156+
m_pathHasTrailingSlash = s_preservePathSeparators ? (!segments.empty() && segments.back() == '/') : m_pathSegments.empty() && (!segments.empty() && segments.back() == '/');
157157
}
158158

159159
/**

tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ TEST_F(S3UnitTest, S3UriPathPreservationOn) {
226226

227227
auto putObjectRequest = PutObjectRequest()
228228
.WithBucket("velvetunderground")
229-
.WithKey("////stephanie////says////////////that////////she//wants///////to/know.txt");
229+
.WithKey("////stephanie////says////////////that////////she//wants///////to/know.txt/");
230230

231231
std::shared_ptr<IOStream> body = Aws::MakeShared<StringStream>(ALLOCATION_TAG,
232232
"What country shall I say is calling From across the world?",
@@ -247,7 +247,7 @@ TEST_F(S3UnitTest, S3UriPathPreservationOn) {
247247
AWS_EXPECT_SUCCESS(response);
248248

249249
const auto seenRequest = _mockHttpClient->GetMostRecentHttpRequest();
250-
EXPECT_EQ("https://velvetunderground.s3.us-east-1.amazonaws.com/////stephanie////says////////////that////////she//wants///////to/know.txt", seenRequest.GetUri().GetURIString());
250+
EXPECT_EQ("https://velvetunderground.s3.us-east-1.amazonaws.com/////stephanie////says////////////that////////she//wants///////to/know.txt/", seenRequest.GetUri().GetURIString());
251251
}
252252

253253
TEST_F(S3UnitTest, S3EmbeddedErrorTest) {

0 commit comments

Comments
 (0)