Skip to content
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

DownloadBuffer with HTTPRange return unexpected number of written bytes #23884

Open
tamir-laminar opened this issue Dec 19, 2024 · 2 comments
Open
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team needs-team-triage Workflow: This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage Storage Service (Queues, Blobs, Files)

Comments

@tamir-laminar
Copy link

Bug Report

  • Bug in the following releases :
    • github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/ - 1.5.0
    • github.com/Azure/azure-sdk-for-go/sdk/storage/azfile/ - 1.4.0
res := make([]byte, 100)
n, err := blobClient.DownloadBuffer(ctx, res, &blob.DownloadBufferOptions{
	Range: blob.HTTPRange{
		Offset: 0,
		Count:  100,
	},
})
fmt.Println(res[:n]) // n is always 100, even if the file has less them 100 bytes, so we get garbage.

If the file have less then requested Count, it should return the number of bytes that were actually written to the buffer (the variable n in that example).
instead it always return the Count, meaning that if we pass the Count in the range option, n is always equals to Count.

It's a problem since we don't now how to slice the response in order to get the actual data without garbage.

The above also true for azfile library.

What I expected

DownloadBuffer(ctx context.Context, buffer []byte, o *DownloadBufferOptions) (int64, error)

DownloadBuffer should return the number of bytes that were actually written to the buffer.

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files) labels Dec 19, 2024
Copy link

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

@jhendrixMSFT jhendrixMSFT removed the Service Attention Workflow: This issue is responsible by Azure service team. label Dec 19, 2024
@github-actions github-actions bot added the needs-team-triage Workflow: This issue needs the team to triage. label Dec 19, 2024
@tanyasethi-msft
Copy link
Member

Hi @tamir-laminar ,
Thanks for reporting this, we are looking into this issue and will get back to you soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team needs-team-triage Workflow: This issue needs the team to triage. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

4 participants