Skip to content

[Storage] Fixed Download/Upload APIs to be compatible with all transports + responses #40615

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 8 commits into
base: main
Choose a base branch
from

Conversation

weirongw23-msft
Copy link
Member

No description provided.

@weirongw23-msft weirongw23-msft marked this pull request as ready for review April 18, 2025 23:49
@Copilot Copilot AI review requested due to automatic review settings April 18, 2025 23:49
@github-actions github-actions bot added the Storage Storage Service (Queues, Blobs, Files) label Apr 18, 2025
Copy link
Contributor

@Copilot 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 updates the Download/Upload APIs to ensure compatibility across all transport types and responses. Key changes include:

  • Updating exception handling in multiple asynchronous policies modules to include AttributeError.
  • Adjustments in test modules and helpers to better distinguish between legacy and modern transport responses.
  • Modifications to asynchronous blob download logic to handle partially consumed streams.

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sdk/storage/azure-storage-queue/azure/storage/queue/_shared/policies_async.py Updated exception handling to catch AttributeError when loading response body.
sdk/storage/azure-storage-file-share/azure/storage/fileshare/_shared/policies_async.py Similar update to exception handling for broader transport compatibility.
sdk/storage/azure-storage-file-datalake/azure/storage/filedatalake/_shared/policies_async.py Exception handling modified to include AttributeError for improved compatibility.
sdk/storage/azure-storage-blob/azure/storage/blob/aio/_download_async.py Modified content processing to check if the response stream is already consumed.
sdk/storage/azure-storage-blob/azure/storage/blob/_shared/policies_async.py Exception handling updated to include AttributeError.
(Test files) Adjustments made in transport tests and helper modules to align with new transport responses.
Files not reviewed (1)
  • sdk/storage/azure-storage-blob/assets.json: Language not supported

@azure-sdk
Copy link
Collaborator

API change check

API changes are not detected in this pull request.

@weirongw23-msft
Copy link
Member Author

Odd reason for test failures - in the AsyncioRequestsTransport tests, the test recordings only show creation of a new container but nothing else.

$ cat sdk/storage/azure-storage-blob/tests/recordings/test_transports_async.pyTestStorageTransportsAsynctest_asyncio_transport.json

{
  "Entries": [
    {
      "RequestUri": "https://Sanitized.blob.core.windows.net/utcontainer39ad2f58?restype=container",
      "RequestMethod": "PUT",
      "RequestHeaders": {
        "Accept": "application/xml",
        "Accept-Encoding": "gzip, deflate",
        "Content-Length": "0",
        "User-Agent": "azsdk-python-storage-blob/12.26.0b1 Python/3.11.12 (macOS-15.4.1-x86_64-i386-64bit)",
        "x-ms-date": "Sat, 19 Apr 2025 06:22:49 GMT",
        "x-ms-version": "2025-05-05"
      },
      "RequestBody": null,
      "StatusCode": 201,
      "ResponseHeaders": {
        "Content-Length": "0",
        "Date": "Sat, 19 Apr 2025 06:22:49 GMT",
        "ETag": "\"0x8DD7F0A9BF67EE5\"",
        "Last-Modified": "Sat, 19 Apr 2025 06:22:49 GMT",
        "Server": [
          "Windows-Azure-Blob/1.0",
          "Microsoft-HTTPAPI/2.0"
        ],
        "x-ms-version": "2025-05-05"
      },
      "ResponseBody": null
    }
  ],
  "Variables": {}
}

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