Skip to content

Simpler S3 CopyObjectRequest#copySource #1313

Closed
@worpet

Description

@worpet

In the original SDK, the source bucket and key vs the destination bucket and key was clear:

new CopyObjectRequest(sourceBucket, sourceKey, destinationBucket, destinationKey)

But in SDK 2, the way the Builder methods are named makes this overly confusing.

Expected Behavior

CopyObjectRequest.Builder should have methods like sourceBucket(bucket) and sourceKey(key) to clearly set the source bucket and source key.

The bucket(bucket) and key(key) methods should be documented as being for the destination values.

Current Behavior

CopyObjectRequest.Builder has only the method copySource(String copySource) which accepts the source bucket and source key, separated by a slash. More importantly, you are required to URL-encode this value, which is easy to overlook. For example, even the AWS documentation example makes the mistake of not encoding. A casual test will appear to work, but may fail later when you happen to have a key that contains an unsafe URL character.

The bucket(bucket) and key(key) methods are not documented as being for the destination values so, when coding, there is no clear way to simply set a copy source and destination without searching for more information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions