Azure / Azurite

A lightweight server clone of Azure Storage that simulates most of the commands supported by it with minimal dependencies
MIT License
1.8k stars 320 forks source link

The error returned in azurite is inconsistent with the one in azure cloud when create and resize page blob with invalid page size. #641

Open zzhxiaofeng opened 3 years ago

zzhxiaofeng commented 3 years ago

Error Description: The error returned in azurite is inconsistent with the one in azure cloud when create and resize page blob with invalid page size. In azure, the error is shown as following: Screenshot 2020-11-19 094736 In azurite, the error is shown as following: Screenshot 2020-11-19 094913

To Reproduce Please run the demo code as following:

import {
 BlobServiceClient, BlockBlobClient, PageBlobClient
} 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 pageBlobClient = await containerClient.getPageBlobClient("<blob-name>");
  try{
    await pageBlobClient.create(511);
  }catch(err){
    console.log(err);
    assert.ok((err as any).response.parsedBody.Code === "InvalidHeaderValue");
  }
}

main();

Error Track: The reason maybe is that the check for create and resize page blob with invalid page size in Azurite is different from the one in Azure. The check code is shown as following: https://github.com/Azure/Azurite/blob/master/src/blob/handlers/PageBlobHandler.ts#L75 Screenshot 2020-11-19 095458

Expected Behavior The error returned in azurite is consistent with the one in azure cloud when create and resize page blob with invalid page size.

@jongio for notification.

blueww commented 3 years ago

@zzhxiaofeng Thanks for raising the issue! We will evaluate it.

We welcome contribution to Azurite. It would be great if you could contribute the the fix of this issue.

v-xuto commented 3 years ago

azsdk-azurite

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.