Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Bug when s_preservePathSeparators enabled #3618

@dongxiao1198

Description

@dongxiao1198

Describe the bug

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

If we enable s_preservePathSeparators at initOption, we can try writing files like:
s3://bucket/test/test_dir/
it seems this path will ignore the tailing slash...and actually writing file
s3://bucket/test/test_dir

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

can handle the tailing slash

Current Behavior

trimmed

Reproduction Steps

Modify this case can find this issue:
tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp

TEST_F(S3UnitTest, S3UriPathPreservationOn) {

diff --git a/tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp b/tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp
index 80bc663d3ed..ea543c3b471 100644
--- a/tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp
+++ b/tests/aws-cpp-sdk-s3-unit-tests/S3UnitTests.cpp
@@ -226,7 +226,7 @@ TEST_F(S3UnitTest, S3UriPathPreservationOn) {

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

And can test uri like:
stephanie////says////////////that////////she//wants///////to/know.txt
stephanie////says////////////that////////she//wants///////to/know.txt/
////stephanie////says////////////that////////she//wants///////to/know.txt
////stephanie////says////////////that////////she//wants///////to/know.txt/
and so on

Possible Solution

No response

Additional Information/Context

No response

AWS CPP SDK version used

master

Compiler and Version used

llvm18

Operating System and version

macos

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions