Skip to content

{Storage} Fix #32039, #32088, #32091: az storage blob download-batch/delete-batch: Fix incorrectly encoding str into byte - #32085

Merged
Zhiyi Huang (calvinhzy) merged 3 commits into
Azure:devfrom
calvinhzy:fix-storage-blob-download-batch-with-pattern
Sep 12, 2025
Merged

Zhiyi Huang (calvinhzy) merged 3 commits into
Azure:devfrom
calvinhzy:fix-storage-blob-download-batch-with-pattern

Conversation

@calvinhzy

@calvinhzy Zhiyi Huang (calvinhzy) commented Sep 9, 2025 •

Copy link
Copy Markdown
Contributor

Related command

Description

Fix #32039 #32091 #32088
Fixing incorrectly encoding a str into utf-8 which would make it a byte.

Testing Guide

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change
[Component Name 2] az command b: Add some customer-facing feature


This checklist is used to make sure that common guidelines for a pull request are followed.

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Sep 9, 2025 •

Copy link
Copy Markdown
️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Sep 9, 2025 •

Copy link
Copy Markdown
️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions

github-actions Bot commented Sep 9, 2025

Copy link
Copy Markdown

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@pfrydids

Copy link
Copy Markdown

Yong Zhang (@yonzhan) Yishi Wang (@evelyn-ys) Please review this and get this merged ASAP

@calvinhzy Zhiyi Huang (calvinhzy) changed the title {Storage} Fix #32039: az storage blob download-batch: Fix encoding str into byte {Storage} Fix #32039, #32088, #32091: az storage blob download-batch: Fix encoding str into byte Sep 11, 2025
@calvinhzy Zhiyi Huang (calvinhzy) changed the title {Storage} Fix #32039, #32088, #32091: az storage blob download-batch: Fix encoding str into byte {Storage} Fix #32039, #32088, #32091: az storage blob download-batch/delete-batch: Fix incorrectly encoding str into byte Sep 11, 2025
@calvinhzy
Zhiyi Huang (calvinhzy) marked this pull request as ready for review September 12, 2025 02:48
Copilot AI review requested due to automatic review settings September 12, 2025 02:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes bugs in Azure CLI storage batch operations where strings were incorrectly being encoded to bytes, causing failures in blob download-batch and delete-batch commands. The fix removes unnecessary UTF-8 encoding logic and improves test coverage.

  • Removes problematic UTF-8 encoding of blob names in the collect_blob_objects function
  • Refactors test structure to use ScenarioTest instead of LiveScenarioTest for better test reliability
  • Adds proper test isolation by using unique container names for each test scenario

Reviewed Changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/azure-cli/azure/cli/command_modules/storage/util.py Removes unnecessary UTF-8 encoding logic that was causing string-to-byte conversion issues
src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_batch_operations.py Refactors tests to use ScenarioTest, adds proper container isolation, and reorganizes test classes

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +734 to +738
def create_and_populate_container(src_container):
self.storage_cmd('storage container create -n {}', storage_account_info, src_container)

# upload test files to storage account
self.storage_cmd('storage blob upload-batch -s "{}" -d {}', storage_account_info, test_dir, src_container)

Copilot AI Sep 12, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The nested function create_and_populate_container is duplicated logic from the original test. Consider extracting this as a helper method of the test class to improve code reusability and maintainability.

Copilot uses AI. Check for mistakes.
@calvinhzy
Zhiyi Huang (calvinhzy) merged commit 1bbfd3c into Azure:dev Sep 12, 2025
48 checks passed
@AKSHAY13405

Copy link
Copy Markdown

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

Labels

Auto-Assign Auto assign by bot Storage az storage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

storage blob download-batch with glob pattern fails in v2.77

7 participants