Skip to content

Conversation

@weirongw23-msft
Copy link
Member

No description provided.

@weirongw23-msft weirongw23-msft marked this pull request as ready for review October 22, 2025 20:58
Copilot AI review requested due to automatic review settings October 22, 2025 20:58
@github-actions github-actions bot added the Storage Storage Service (Queues, Blobs, Files) label Oct 22, 2025
Copy link
Contributor

Copilot AI left a 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 decompress parameter to the download_blob method in both sync and async blob clients
  • Modified the download implementation to handle the decompress parameter 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
Copy link

Copilot AI Oct 22, 2025

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.

Suggested change
: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

Copilot uses AI. Check for mistakes.
Copy link
Member Author

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...

Copy link
Member

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
Copy link

Copilot AI Oct 22, 2025

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.

Suggested change
: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

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

API Change Check

APIView identified API level changes in this PR and created the following API reviews

azure-storage-blob

@weirongw23-msft
Copy link
Member Author

/azp run python - storage - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants