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

[BUG] Incorrect documentation for BlockBlobClient.StageBlockAsync #43413

Closed
joshatendgame opened this issue Apr 15, 2024 · 3 comments · Fixed by #45942
Closed

[BUG] Incorrect documentation for BlockBlobClient.StageBlockAsync #43413

joshatendgame opened this issue Apr 15, 2024 · 3 comments · Fixed by #45942
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 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)

Comments

@joshatendgame
Copy link

Library name and version

Azure.Storage.Blobs 12.16.0

Describe the bug

The documentation for BlockBlobClient.StageBlockAsync is wrong.

Expected behavior

It should not tell you to URL encode the base64BlockId parameter.

Actual behavior

It currently says to "Note that the Base64 string must be URL-encoded." This is erroneous as the library itself URL encodes this parameter, and the request will fail if the consuming code tries to do so itself.

Reproduction Steps

Read the documentation and observe that it is wrong.

Environment

No response

@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. labels Apr 15, 2024
Copy link

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

@github-actions github-actions bot added the Storage Storage Service (Queues, Blobs, Files) label Apr 15, 2024
@nickliu-msft
Copy link
Member

Hi @joshatendgame, thanks for submitting this issue. I am not very familiar with the BlockBlobClient.StageBlockAsync code but from my tracing of it, I do not see the SDK encoding the base64BlockId param. Would you be able to show me where this is done?

@joshatendgame
Copy link
Author

@nickliu-msft Hi Nick, thanks for your response. The encoding is done in BlockBlobRestClient.CreateStageBlockRequest (line 505 of that file in main currently) by passing true as the third argument to RawRequestUriBuilder.AppendQuery. (This eventually leads to a call to Uri.EscapeDataString inside RequestUriBuilder).

What is important is that if the consumer of BlockBlobClient follows the instructions to URI encode the parameter, then the URI-unsafe characters in the base64 encoded id (=, / and +) will be double escaped and the request will fail.

The documentation appears to have been copied from the same source as the documentation for the REST API here, for which it is appropriate as consumers of the raw REST API obviously need to escape the parameter: https://learn.microsoft.com/en-us/rest/api/storageservices/put-block

Hope that helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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 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)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants