-
Couldn't load subscription status.
- Fork 3.2k
[Storage] Decompression for Binary Response in Download APIs #43587
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for automatic decompression of compressed blob content during download operations in the Azure Storage Blob SDK. The feature allows users to control whether compressed content (e.g., gzip) should be automatically decompressed by passing a decompress parameter to the download_blob method.
Key Changes:
- Added a new optional
decompressparameter to thedownload_blobmethod in both sync and async blob clients - Modified the download implementation to handle the
decompressparameter correctly when encryption is used - Added comprehensive tests for both sync and async scenarios to verify decompression behavior
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
azure/storage/blob/_blob_client.py |
Added documentation for the new decompress parameter in the sync blob client |
azure/storage/blob/_blob_client.pyi |
Added type hints for the decompress parameter across all download_blob overloads in sync client |
azure/storage/blob/_download.py |
Modified to preserve the decompress parameter during encryption data requests in sync implementation |
azure/storage/blob/aio/_blob_client_async.py |
Added documentation for the new decompress parameter in the async blob client |
azure/storage/blob/aio/_blob_client_async.pyi |
Added type hints for the decompress parameter across all download_blob overloads in async client |
azure/storage/blob/aio/_download_async.py |
Modified to preserve the decompress parameter during encryption data requests in async implementation |
tests/test_common_blob.py |
Added test case to verify decompression behavior in sync client |
tests/test_common_blob_async.py |
Added test case to verify decompression behavior in async client |
| function(current: int, total: int) where current is the number of bytes transferred | ||
| so far, and total is the total size of the download. | ||
| :paramtype progress_hook: Callable[[int, int], None] | ||
| :keyword bool decompress: If True, any compressed content, identified by the Content-Type header, will be |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation states that compression is identified by the Content-Type header, but based on the test cases which use 'content_encoding', it appears compression is actually identified by the Content-Encoding header, not Content-Type. The documentation should be corrected to reference Content-Encoding.
| :keyword bool decompress: If True, any compressed content, identified by the Content-Type header, will be | |
| :keyword bool decompress: If True, any compressed content, identified by the Content-Encoding header, will be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not quite right. The Content-Encoding header specifies gzip if we are trying to download the content in compressed format. Technically the header is x-ms-blob-content-md5 that contains the content...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot is right here
| function(current: int, total: int) where current is the number of bytes transferred | ||
| so far, and total is the total size of the download. | ||
| :paramtype progress_hook: Callable[[int, int], Awaitable[None]] | ||
| :keyword bool decompress: If True, any compressed content, identified by the Content-Type header, will be |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation states that compression is identified by the Content-Type header, but based on the test cases which use 'content_encoding', it appears compression is actually identified by the Content-Encoding header, not Content-Type. The documentation should be corrected to reference Content-Encoding.
| :keyword bool decompress: If True, any compressed content, identified by the Content-Type header, will be | |
| :keyword bool decompress: If True, any compressed content, identified by the Content-Encoding header, will be |
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
|
/azp run python - storage - tests |
|
Azure Pipelines successfully started running 1 pipeline(s). |
No description provided.