Skip to content

Implemented No-overwrite for uploads using cp command #9569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: s3-no-overwrite
Choose a base branch
from

Conversation

rakshil14-2
Copy link

@rakshil14-2 rakshil14-2 commented Jun 24, 2025

Issue : Github Issue #2874

Description of changes:

Customers requested to prevent overwriting of objects. This is done by providing no-overwrite header using ifNoneMatch feature of Amazon S3 which only allows to upload objects that are not present on the bucket. The no-overwrite header provides support to multi-part upload as well as works well with other cp command headers. Customer can be implemented using aws s3 cp <source> <destination> --no-overwrite which allows successful uploads when object with the same name is not present on the destination. However, if the user tries to upload the object which is already present at the target bucket using command line, a warning about skipping the file will be displayed and that object is not allowed to upload to S3 bucket.

Testing:
Functional testing is performed to validate the object upload process. This included both scenarios uploading an object when object with same key is already present in the bucket as well as those when the object with same key is not present on bucket. These tests were conducted for both single-part uploads as well as multipart uploads.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@rakshil14-2 rakshil14-2 force-pushed the no_overwrite_for_cp_command branch from a66905b to 69ea8ad Compare June 24, 2025 22:32
@rakshil14-2 rakshil14-2 marked this pull request as ready for review June 25, 2025 01:55
Customizing error message

test cases for no_overwrite for upload operations using cp command

Code cleanup

Test cases for move command
@rakshil14-2 rakshil14-2 force-pushed the no_overwrite_for_cp_command branch from 41b7423 to 8ad2ec2 Compare June 25, 2025 01:57
@@ -109,6 +110,7 @@ def on_progress(self, future, bytes_transferred, **kwargs):

class DoneResultSubscriber(BaseResultSubscriber, OnDoneFilteredSubscriber):
def _on_success(self, future):

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: clean up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants