Skip to content

Commit bb88aba

Browse files
committed
Fix:duplicate trailing slashes in URIs
1 parent 8414fb0 commit bb88aba

File tree

2 files changed

+4
-4
lines changed
  • src/aws-cpp-sdk-core

2 files changed

+4
-4
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 = (!segments.empty() && segments.back() == '/');
156+
m_pathHasTrailingSlash = (m_pathSegments.empty() || !s_preservePathSeparators) && (!segments.empty() && segments.back() == '/');
157157
}
158158

159159
/**

src/aws-cpp-sdk-core/source/http/URI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Aws::String URI::GetPath() const
206206
path.append(segment);
207207
}
208208

209-
if (m_pathSegments.empty() || (m_pathHasTrailingSlash && !s_preservePathSeparators))
209+
if (m_pathSegments.empty() || m_pathHasTrailingSlash)
210210
{
211211
path.push_back('/');
212212
}
@@ -223,7 +223,7 @@ Aws::String URI::GetURLEncodedPath() const
223223
ss << '/' << StringUtils::URLEncode(segment.c_str());
224224
}
225225

226-
if (m_pathSegments.empty() || (m_pathHasTrailingSlash && !s_preservePathSeparators))
226+
if (m_pathSegments.empty() || m_pathHasTrailingSlash)
227227
{
228228
ss << '/';
229229
}
@@ -243,7 +243,7 @@ Aws::String URI::GetURLEncodedPathRFC3986() const
243243
ss << '/' << urlEncodeSegment(segment, m_useRfcEncoding);
244244
}
245245

246-
if (m_pathSegments.empty() || (m_pathHasTrailingSlash && !s_preservePathSeparators))
246+
if (m_pathSegments.empty() || m_pathHasTrailingSlash)
247247
{
248248
ss << '/';
249249
}

0 commit comments

Comments
 (0)