Skip to content

[Storage] az storage blob allow empty blob with data - #33803

Open
Pan-Qi wants to merge 1 commit into
devfrom
bernard-allow-empty-blob-with-data
Open

[Storage] az storage blob allow empty blob with data#33803
Pan-Qi wants to merge 1 commit into
devfrom
bernard-allow-empty-blob-with-data

Conversation

@Pan-Qi

@Pan-Qi Pan-Qi commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Related command

az storage blob upload

Description

Fix issue: #31852

Fixes az storage blob upload --data '' so an explicitly empty data value is treated as provided input and can be used to upload an empty blob.

The upload validator now checks whether --data is omitted by comparing against None, instead of relying on truthiness. This preserves the existing validation for missing input and mutually exclusive --file / --data arguments.

Added unit test coverage for empty --data, non-empty --data, file upload input, conflicting --file and --data, and missing upload input.

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

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@yonzhan

yonzhan commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

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

@Pan-Qi Pan-Qi added ai-custom-code Code generated by ai-custom-code Github Copilot agent. and removed Storage az storage Auto-Assign Auto assign by bot act-codegen-extensibility-squad labels Jul 28, 2026
@Pan-Qi
Pan-Qi force-pushed the bernard-allow-empty-blob-with-data branch from 1e9d047 to 046b63f Compare July 28, 2026 13:39
@Pan-Qi
Pan-Qi marked this pull request as ready for review July 31, 2026 05:22
@Pan-Qi
Pan-Qi requested a review from a team as a code owner July 31, 2026 05:22
Copilot AI review requested due to automatic review settings July 31, 2026 05:22
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

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 pull request fixes az storage blob upload --data '' so an explicitly empty --data value is treated as provided input (rather than being rejected as “missing”), enabling uploads of empty blobs via --data.

Changes:

  • Updated validate_upload_blob to detect “data was provided” via namespace.data is not None instead of truthiness checks.
  • Added unit tests covering empty/non-empty --data, --file, mutual exclusivity errors, and missing input errors.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/azure-cli/azure/cli/command_modules/storage/_validators.py Adjusts upload input validation to allow empty-string --data while preserving mutual exclusivity and required-input checks.
src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_validators.py Adds direct unit coverage for validate_upload_blob across expected valid/invalid input combinations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

ai-custom-code Code generated by ai-custom-code Github Copilot agent.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants