Inconsistent error status code in Azurite and Azure when use the method beginCopyFromURL on block blob
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 393
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 36
Description
**Error Description:**
IfModifiedSince specify this conditional header to copy the blob from url only if the destination blob has been modified since the specified date/time. If the destination blob has not been modified, the Azure returns status code 412 (Precondition Failed).
But in Azurite, it returns status code 304.
In azure, the error is shown as following:

In azurite, the error is shown as following:

**To Reproduce**
Please run the demo code as following:
```
import {
BlobServiceClient
} from "@azure/storage-blob";
import * as assert from "assert"
async function main() {
const blobServiceClient = await BlobServiceClient.fromConnectionString("Azurite-https-connectionString");
const containerClient = await blobServiceClient.getContainerClient("");
const originBlobClient = await containerClient.getBlockBlobClient("");
const newBlobClient = await containerClient.getBlockBlobClient("");
try{
await newBlobClient.beginCopyFromURL(originBlobClient.url,{sourceConditions:{
ifModifiedSince:new Date()
}})
}catch(e){
console.log((err as any).response.status);
assert.ok((err as any).response.status === "412");
}
}
main();
```
**Error Track**
When use the method beginCopyFromURL on block blob in azurite, the process code and return error code for the ifModifiedSince are shown as following:
[https://github.com/Azure/Azurite/blob/master/src/blob/conditions/ReadConditionalHeadersValidator.ts#L90](https://github.com/Azure/Azurite/blob/master/src/blob/conditions/ReadConditionalHeadersValidator.ts#L90)
[https://github.com/Azure/Azurite/blob/master/src/blob/conditions/ReadConditionalHeadersValidator.ts#L107](https://github.com/Azure/Azurite/blob/master/src/blob/conditions/ReadConditionalHeadersValidator.ts#L107)

**Expected Behavior**
If the destination blob has not been modified in the date time specified by the ifModifiedSince, the error returned in Azurite is consistent with the one in Azure.
@jongio for notification.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.