Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.25k stars 4.6k forks source link

[BUG] StageBlockAsync() doesn't support non-seekable streams #44909

Open artemtaranych opened 2 months ago

artemtaranych commented 2 months ago

Library name and version

Azure.Storage.Blobs 12.20.0.0

Describe the bug

If you pass content that has the property canSeek = false, the operation fails with a NotSupportedException stating "Specified method is not supported."

Expected behavior

The operation should follow the same logic as UploadAsync and PooledMemoryStream.BufferStreamPartitionInternal, handling non-seekable streams appropriately.

Actual behavior

An exception NotSupportedException is thrown with the message "Specified method is not supported."

Reproduction Steps

Code Example: The following code snippet demonstrates where the issue occurs:

response = await BlockBlobRestClient.StageBlockAsync(
    blockId: base64BlockId,
    contentLength: (content?.Length - content?.Position) ?? 0,
    // ... other parameters
);

This code can be found in the Azure SDK repository: https://github.com/Azure/azure-sdk-for-net/blob/4a0ec102d719152731688462b439d0cbedadb52e/sdk/storage/Azure.Storage.Common/src/Shared/PartitionedUploader.cs

Environment

No response

github-actions[bot] commented 2 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.