Skip to content

Conversation

@WH-2099
Copy link

@WH-2099 WH-2099 commented Sep 15, 2025

This pull request introduces several improvements and new features to the S3 client, with a particular focus on content-type inference, object operations (copy and rename), and code readability. The most notable changes are the addition of server-side copy and rename operations, automatic content-type inference for uploads, and refactoring for better maintainability and clarity.

New S3 Object Operations

  • Added a new copy method to S3Client that performs server-side object copying within or between buckets using the S3 CopyObject API. This method supports metadata replacement and content-type updates.
  • Introduced a rename method to S3Client, which moves an object by copying it to a new key and then deleting the source. This operation is non-atomic and handles error reporting.
  • Updated the README.md to document the new copy and rename operations with example usage.

Content-Type Inference

  • Implemented automatic Content-Type inference for uploads (including multipart) using Python's mimetypes library, falling back to application/octet-stream if the type cannot be determined. This is applied in put, post, put_file, put_file_multipart, and put_multipart methods.
  • Added documentation in README.md describing how content-type inference works and when it is applied.

@WH-2099
Copy link
Author

WH-2099 commented Sep 15, 2025

I tidied up the code a bit, please excuse my little obsession with neatness.

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.

1 participant