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("<container-name>");
const originBlobClient = await containerClient.getBlockBlobClient("<origin-blob-name>");
const newBlobClient = await containerClient.getBlockBlobClient("<new-blob-name>");
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();
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.
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:
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#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.