aws-sdk-java icon indicating copy to clipboard operation
aws-sdk-java copied to clipboard

(short issue description)

Open alayne-xumo opened this issue 1 year ago • 0 comments

Upcoming End-of-Support

  • [X] I acknowledge the upcoming end-of-support for AWS SDK for Java v1 was announced, and migration to AWS SDK for Java v2 is recommended.

Describe the bug

This bug stems from the fact that s3 "urls" dont conform to the url spec, because they allow things like spaces which for urls have to be encoded. While "s3://mybucket/my key+something" is a valid s3 url it is not a valid url/uri.

So final S3Uri s3Uri = s3.utilities().parseUri(URI.create(s3Url)); results in a parse exception. parseUri should probably accept a string instead of a Uri.

Expected Behavior

I should be able to parse any s3 "url" that will resolve to an object in s3.

Current Behavior

Illegal character in path at index 16: s3://mybucket/my key+something

Reproduction Steps

    try (final S3Client s3 = S3Client.builder()
            .region(Region.US_EAST_1)
            .credentialsProvider(credentialsProvider)
            .build()) {
        final S3Uri s3Uri = s3.utilities().parseUri(URI.create("s3://mybucket/my key+something"));

Possible Solution

parseUri should accept a string.

Additional Information/Context

No response

AWS Java SDK version used

2.20.45

JDK version used

8

Operating System and version

Sonoma

alayne-xumo avatar Apr 19 '24 19:04 alayne-xumo