[BUG] BlobClient.Exists() fails if a blob was uploaded with a customer-provided encryption key #20361
Labels
bug
This issue requires a change to an existing behavior in the product in order to be resolved.
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
Storage
Storage Service (Queues, Blobs, Files)
Describe the bug
We have blobs that are uploaded with a
CustomerProvidedKey
(the REST equivalent would be uploading with thex-ms-encryption-key
header).At some later time, we want to check whether one of these blobs exists using the
BlobClient.Exists()
method. Importantly, theBlobClient
instance used to callExists()
is NOT configured with aCustomerProvidedKey
.Expected behavior
Regardless of whether the
BlobClient
knows a blob'sCustomerProvidedKey
, theExists()
method should returntrue
if the blob exists. (This is possible, see Further Discussion below.)Actual behavior
When a
BlobClient
with noCustomerProvidedKey
is used to callExists()
on a blob which was uploaded previously with aCustomerProvidedKey
, it gets a 409 error response because the Azure Blob API expects the same encryption key to be passed.The message returned is "The blob is encrypted with customer specified encryption, but it was not provided in the request", and the
x-ms-error-code
response header is set to "BlobUsesCustomerSpecifiedEncryption".Further Discussion
I'm not disputing how the REST API works here; the fact that it's returning this error response makes perfect sense to me. The issue I have is with the SDK's handling of it: I'm just calling
BlobClient.Exists()
, and this particular error response from the REST API is proof positive that the blob does indeed exist...so my expectation is that the SDK would eat this particular error response and just returntrue
, not error out.To Reproduce
CustomerProvidedKey
.BlobClient
instance pointed at said blob (which does not have aCustomerProvidedKey
configured), callExists()
Environment:
The text was updated successfully, but these errors were encountered: