aiohttp-s3-client icon indicating copy to clipboard operation
aiohttp-s3-client copied to clipboard

Add copy/rename; Content-Type inference; tests/docs

Open WH-2099 opened this issue 3 months ago • 1 comments

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 avatar Sep 15 '25 16:09 WH-2099

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

WH-2099 avatar Sep 15 '25 16:09 WH-2099