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

Azurite doesn't support Create Blob with blob name that is empty string #630

Open zzhxiaofeng opened 3 years ago

zzhxiaofeng commented 3 years ago

Error Description: In Azure, it will create blob successfully when create blob with blob name that is empty string. But in Azurite, it will return an error as following in this case: Screenshot 2020-11-18 142706

To Reproduce Please run the demo code as following:

import {
 BlobServiceClient
} from "@azure/storage-blob";

async function main(){
  const blobServiceClient = await BlobServiceClient.fromConnectionString("<Azurite-https-connectionString>");
  const containerClient=await blobServiceClient.getContainerClient("<container-name>");
  const appendBlobClient = await containerClient.getAppendBlobClient("<blob-name>");
}

main();

Error Track:

  1. When send request, Azurite will construct a pattern by request to match the corresponding handler method. it will construct a pattern(/container) without blob when use a blob name of empty string to create blob https://github.com/Azure/Azurite/blob/master/src/blob/middlewares/blobStorageContext.middleware.ts#L80 Screenshot 2020-11-18 110406

  2. When use the pattern to match handler method, it doesn't match the blob create handler method because the blob create handler method need a pattern like "container/blob". https://github.com/Azure/Azurite/blob/master/src/blob/generated/middleware/dispatch.middleware.ts#L105 Screenshot 2020-11-18 111154 https://github.com/Azure/Azurite/blob/master/src/blob/generated/artifacts/specifications.ts#L2027 Screenshot 2020-11-18 145639

Expected Behavior When create blob with blob name that is empty string in azurite, it can create blob successfully.

@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