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

PageBlob_Create: Create Blob in $root container with "/" in blob name, Azurite succes, but server fail with 400 #322

Open blueww opened 4 years ago

blueww commented 4 years ago

Which service(blob, file, queue, table) does this issue concern?

blob

Which version of the Azurite was used?

3.3.0-preview

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

VS code

What's the Node.js version?

v10.15.3

What problem was encountered?

PageBlob_Create: Create Blob in $root container with "/" in blob name, Azurite succes, but server fail with 400

Steps to reproduce the issue?

Create Blob "Dir1/Blob" in $root container

Server will fail with "HTTP/1.1 400 The requested URI does not represent any resource on the server." Azurite will success

Have you found a mitigation/solution?

No

Test case:

Test Name:  CloudBlobDirectoryValidateInRootContainer
Test FullName:  Microsoft.Azure.Storage.Blob.CloudBlobDirectoryTest.CloudBlobDirectoryValidateInRootContainer
Test Source:    C:\code\azure-storage-net\Test\ClassLibraryCommon\Blob\CloudBlobDirectoryTest.cs : line 644
Test Outcome:   Failed
Test Duration:  0:00:00.2817027

Result StackTrace:  
at Microsoft.Azure.Storage.TestHelper.ExpectedException(Action operation, String operationDescription, HttpStatusCode expectedStatusCode, String requestErrorCode) in C:\code\azure-storage-net\Test\ClassLibraryCommon\TestHelper.cs:line 55
   at Microsoft.Azure.Storage.Blob.CloudBlobDirectoryTest.CloudBlobDirectoryValidateInRootContainer() in C:\code\azure-storage-net\Test\ClassLibraryCommon\Blob\CloudBlobDirectoryTest.cs:line 657
Result Message: Assert.Fail failed. No Storage exception received while expecting BadRequest: Try to create a CloudBlobDirectory/blob which has a slash in its name in the root container

Debug Log:

2019-12-17T09:29:18.249Z 4da17c33-257e-43c1-86ab-7a683bb7134e info: BlobStorageContextMiddleware: RequestMethod=PUT RequestURL=http://127.0.0.1/devstoreaccount1/$root/Dir1/Blob1 RequestHeaders:{"x-ms-blob-type":"PageBlob","x-ms-blob-content-length":"0","x-ms-client-request-id":"761f23a9-6e0c-41ad-b876-7da60cc4b6b2","user-agent":"Azure-Storage/11.1.1 (.NET Core; Win32NT 6.2.9200.0)","x-ms-version":"2019-02-02","x-ms-date":"Tue, 17 Dec 2019 09:29:18 GMT","authorization":"SharedKey devstoreaccount1:EK98OdIb3nb1jkQOVnZjDP8k5cSi8ZwRRUnIFtBuxCw=","content-length":"0","host":"127.0.0.1:10000"} ClientIP=127.0.0.1 Protocol=http HTTPVersion=1.1
2019-12-17T09:29:18.250Z 4da17c33-257e-43c1-86ab-7a683bb7134e info: BlobStorageContextMiddleware: Account=devstoreaccount1 Container=$root Blob=Dir1/Blob1
2019-12-17T09:29:18.250Z 4da17c33-257e-43c1-86ab-7a683bb7134e verbose: DispatchMiddleware: Dispatching request...
2019-12-17T09:29:18.252Z 4da17c33-257e-43c1-86ab-7a683bb7134e info: DispatchMiddleware: Operation=PageBlob_Create
2019-12-17T09:29:18.252Z 4da17c33-257e-43c1-86ab-7a683bb7134e verbose: AuthenticationMiddlewareFactory:createAuthenticationMiddleware() Validating authentications.
2019-12-17T09:29:18.252Z 4da17c33-257e-43c1-86ab-7a683bb7134e info: PublicAccessAuthenticator:validate() Start validation against public access.
2019-12-17T09:29:18.253Z 4da17c33-257e-43c1-86ab-7a683bb7134e debug: PublicAccessAuthenticator:validate() Getting account properties...
2019-12-17T09:29:18.253Z 4da17c33-257e-43c1-86ab-7a683bb7134e debug: PublicAccessAuthenticator:validate() Retrieved account name from context: devstoreaccount1, container: $root, blob: Dir1/Blob1
2019-12-17T09:29:18.264Z 4da17c33-257e-43c1-86ab-7a683bb7134e debug: PublicAccessAuthenticator:validate() Skip public access authentication. Cannot get public access type for container $root
2019-12-17T09:29:18.264Z 4da17c33-257e-43c1-86ab-7a683bb7134e info: BlobSharedKeyAuthenticator:validate() Start validation against account shared key authentication.
2019-12-17T09:29:18.265Z 4da17c33-257e-43c1-86ab-7a683bb7134e info: BlobSharedKeyAuthenticator:validate() [STRING TO SIGN]:"PUT\n\n\n\n\n\n\n\n\n\n\n\nx-ms-blob-content-length:0\nx-ms-blob-type:PageBlob\nx-ms-client-request-id:761f23a9-6e0c-41ad-b876-7da60cc4b6b2\nx-ms-date:Tue, 17 Dec 2019 09:29:18 GMT\nx-ms-version:2019-02-02\n/devstoreaccount1/devstoreaccount1/$root/Dir1/Blob1"
2019-12-17T09:29:18.265Z 4da17c33-257e-43c1-86ab-7a683bb7134e info: BlobSharedKeyAuthenticator:validate() Calculated authentication header based on key1: SharedKey devstoreaccount1:EK98OdIb3nb1jkQOVnZjDP8k5cSi8ZwRRUnIFtBuxCw=
2019-12-17T09:29:18.265Z 4da17c33-257e-43c1-86ab-7a683bb7134e info: BlobSharedKeyAuthenticator:validate() Signature 1 matched.
2019-12-17T09:29:18.265Z 4da17c33-257e-43c1-86ab-7a683bb7134e verbose: DeserializerMiddleware: Start deserializing...
2019-12-17T09:29:18.266Z 4da17c33-257e-43c1-86ab-7a683bb7134e info: HandlerMiddleware: DeserializedParameters={"options":{"metadata":{},"requestId":"761f23a9-6e0c-41ad-b876-7da60cc4b6b2","blobHTTPHeaders":{},"leaseAccessConditions":{},"cpkInfo":{},"modifiedAccessConditions":{}},"contentLength":0,"blobContentLength":0,"version":"2019-02-02","blobType":"PageBlob"}
2019-12-17T09:29:18.272Z 4da17c33-257e-43c1-86ab-7a683bb7134e verbose: SerializerMiddleware: Start serializing...
2019-12-17T09:29:18.272Z 4da17c33-257e-43c1-86ab-7a683bb7134e info: EndMiddleware: End response. TotalTimeInMS=23 StatusCode=201 StatusMessage=undefined Headers={"server":"Azurite-Blob/3.3.0-preview","etag":"\"d-OaQFkAnJaJt+hvFx/S0pr5IgVmw\"","last-modified":"Tue, 17 Dec 2019 09:29:18 GMT","x-ms-client-request-id":"761f23a9-6e0c-41ad-b876-7da60cc4b6b2","x-ms-request-id":"4da17c33-257e-43c1-86ab-7a683bb7134e","x-ms-version":"2019-02-02","date":"Tue, 17 Dec 2019 09:29:18 GMT","x-ms-request-server-encrypted":"true"}
2019-12-17T09:29:48.035Z     info: AccountDataStore:init() Refresh accounts from environment variable AZURITE_ACCOUNTS with value undefined
2019-12-17T09:29:48.036Z     info: AccountDataStore:init() Fallback to default emulator account devstoreaccount1.
2019-12-17T09:30:48.035Z     info: AccountDataStore:init() Refresh accounts from environment variable AZURITE_ACCOUNTS with value undefined
2019-12-17T09:30:48.036Z     info: AccountDataStore:init() Fallback to default emulator account devstoreaccount1.
XiaoningLiu commented 4 years ago

$root container is not supported yet

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.