Azurite emulator does not return 412 Precondition failed providing IfMatch = "*" for blob uploads for non-existent blob
Which service(blob, file, queue, table) does this issue concern? blob
Which version of the Azurite was used? 3.34.0
Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension) Visual Studio here
What's the Node.js version? v22.17.0
What problem was encountered? Expected blob upload operation to fail with 412 Precondition failed when the blob does not already exist and the If-Match header is set to "*". However, the operation succeeds instead of a 412 precondition failure raising which is not consistent with Azure Storage and the Azure Storage Emulator (Legacy) here.
Steps to reproduce the issue?
- Start the Azurite emulator
- Upload a blob with the if-match="*" header
- Observe that the request succeeds which is incorrect instead of returning a 412 precondition failed error
Have you found a mitigation/solution? No
@jasoncheungg
Would you please share the Azurite debug log? There are several APIs can be used to upload blob, we would like to confirm which API you use with Azurite debug log.
It looks the code need to fix is: https://github.com/Azure/Azurite/blob/fd1103bbf702dc35220ba282260176132d7c7844/src/blob/conditions/WriteConditionalHeadersValidator.ts#L105
Currently when the blob not exist, azurite will return error when ifMatch != "*", but won't return error when ifMatch == "*".
Should change the behavior aligned with server.
@jasoncheungg Azurite welcome contribution! Would your team like to raise a PR to fix this?