From e4c0634a0ce2d861279f79422ba5d59d19ab7889 Mon Sep 17 00:00:00 2001
From: Gauri Prasad <51212198+gapra-msft@users.noreply.github.com>
Date: Wed, 13 Jan 2021 12:14:11 -0800
Subject: [PATCH] Fixed bug where getFileClient and getSubDirectoryClient on
DirectoryClient would throw IllegalArgumentException if either resource had
special characters. (#18542)
---
.../azure-storage-file-datalake/CHANGELOG.md | 2 +-
.../DataLakeDirectoryAsyncClient.java | 8 +-
.../file/datalake/DirectoryAPITest.groovy | 32 ++++++-
...PITestgetfileandsubdirectoryclient[0].json | 86 +++++++++++++++++++
...PITestgetfileandsubdirectoryclient[1].json | 86 +++++++++++++++++++
...PITestgetfileandsubdirectoryclient[2].json | 86 +++++++++++++++++++
...PITestgetfileandsubdirectoryclient[3].json | 86 +++++++++++++++++++
7 files changed, 379 insertions(+), 7 deletions(-)
create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[0].json
create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[1].json
create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[2].json
create mode 100644 sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[3].json
diff --git a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md
index a0161c3869c88..796002d7f853d 100644
--- a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md
+++ b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md
@@ -1,7 +1,7 @@
# Release History
## 12.4.0-beta.2 (Unreleased)
-
+- Fixed bug where getFileClient and getSubDirectoryClient on DirectoryClient would throw IllegalArgumentException if either resource had special characters.
## 12.4.0-beta.1 (2020-12-07)
- Added support to list paths on a directory.
diff --git a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeDirectoryAsyncClient.java b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeDirectoryAsyncClient.java
index bd3db9637cf51..6b1339c923619 100644
--- a/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeDirectoryAsyncClient.java
+++ b/sdk/storage/azure-storage-file-datalake/src/main/java/com/azure/storage/file/datalake/DataLakeDirectoryAsyncClient.java
@@ -173,8 +173,8 @@ public DataLakeFileAsyncClient getFileAsyncClient(String fileName) {
return new DataLakeFileAsyncClient(getHttpPipeline(),
StorageImplUtils.appendToUrlPath(getPathUrl(), Utility.urlEncode(Utility.urlDecode(fileName))).toString(),
- getServiceVersion(), getAccountName(), getFileSystemName(), getObjectPath() + "/"
- + Utility.urlDecode(fileName), blockBlobAsyncClient);
+ getServiceVersion(), getAccountName(), getFileSystemName(), Utility.urlEncode(getObjectPath() + "/"
+ + Utility.urlDecode(fileName)), blockBlobAsyncClient);
}
/**
@@ -315,8 +315,8 @@ public DataLakeDirectoryAsyncClient getSubdirectoryAsyncClient(String subdirecto
return new DataLakeDirectoryAsyncClient(getHttpPipeline(),
StorageImplUtils.appendToUrlPath(getPathUrl(), Utility.urlEncode(Utility.urlDecode(subdirectoryName)))
- .toString(), getServiceVersion(), getAccountName(), getFileSystemName(), getObjectPath() + "/"
- + Utility.urlDecode(subdirectoryName), blockBlobAsyncClient);
+ .toString(), getServiceVersion(), getAccountName(), getFileSystemName(),
+ Utility.urlEncode(getObjectPath() + "/" + Utility.urlDecode(subdirectoryName)), blockBlobAsyncClient);
}
/**
diff --git a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAPITest.groovy b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAPITest.groovy
index 2a6eab6b7d326..dfe20fb295b85 100644
--- a/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAPITest.groovy
+++ b/sdk/storage/azure-storage-file-datalake/src/test/java/com/azure/storage/file/datalake/DirectoryAPITest.groovy
@@ -6,12 +6,11 @@ import com.azure.core.http.HttpPipelineNextPolicy
import com.azure.core.http.HttpRequest
import com.azure.core.http.policy.HttpPipelinePolicy
import com.azure.core.http.rest.Response
-import com.azure.core.test.http.MockHttpResponse
import com.azure.core.util.Context
import com.azure.identity.DefaultAzureCredentialBuilder
import com.azure.storage.blob.BlobUrlParts
import com.azure.storage.blob.models.BlobErrorCode
-
+import com.azure.storage.common.Utility
import com.azure.storage.file.datalake.models.*
import com.azure.storage.file.datalake.options.PathRemoveAccessControlRecursiveOptions
import com.azure.storage.file.datalake.options.PathSetAccessControlRecursiveOptions
@@ -3001,4 +3000,33 @@ class DirectoryAPITest extends APISpec {
then:
thrown(DataLakeStorageException)
}
+
+ @Unroll
+ def "Get file and subdirectory client"() {
+ setup:
+ def dirName = generatePathName()
+ def subPath = generatePathName()
+ dc = fsc.getDirectoryClient(resourcePrefix + dirName)
+
+ when:
+ def fileClient = dc.getFileClient(subResourcePrefix + subPath)
+
+ then:
+ notThrown(IllegalArgumentException)
+ fileClient.getFilePath() == Utility.urlDecode(resourcePrefix) + dirName + "/" + Utility.urlDecode(subResourcePrefix) + subPath
+
+ when:
+ def subDirectoryClient = dc.getSubdirectoryClient(subResourcePrefix + subPath)
+
+ then:
+ notThrown(IllegalArgumentException)
+ subDirectoryClient.getDirectoryPath() == Utility.urlDecode(resourcePrefix) + dirName + "/" + Utility.urlDecode(subResourcePrefix) + subPath
+
+ where:
+ resourcePrefix | subResourcePrefix || _
+ "" | "" || _
+ Utility.urlEncode("%") | "" || _ // Resource has special character
+ "" | Utility.urlEncode("%") || _ // Sub resource has special character
+ Utility.urlEncode("%") | Utility.urlEncode("%") || _
+ }
}
diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[0].json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[0].json
new file mode 100644
index 0000000000000..357ce2907339e
--- /dev/null
+++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[0].json
@@ -0,0 +1,86 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.blob.core.windows.net/jtfsgetfileandsubdirectoryclient0666514fdd6f3a9f15?restype=container",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.10.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "5cc3fb9d-064e-4f74-89bb-e3cdac37eb45"
+ },
+ "Response" : {
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D8B672442E282B",
+ "Last-Modified" : "Mon, 11 Jan 2021 20:48:35 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "640874c0-d01e-003a-2d5b-e857d8000000",
+ "Date" : "Mon, 11 Jan 2021 20:48:35 GMT",
+ "x-ms-client-request-id" : "5cc3fb9d-064e-4f74-89bb-e3cdac37eb45"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.dfs.core.windows.net/jtfsgetfileandsubdirectoryclient0666514fdd6f3a9f15/javapathgetfileandsubdirectoryclient1242530d3d09019a?resource=directory",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.4.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "be540635-f414-4786-88b0-177efde83845"
+ },
+ "Response" : {
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D8B67244B0FC45",
+ "Last-Modified" : "Mon, 11 Jan 2021 20:48:36 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "4c80f854-b01f-005e-465b-e8a640000000",
+ "Date" : "Mon, 11 Jan 2021 20:48:36 GMT",
+ "x-ms-client-request-id" : "be540635-f414-4786-88b0-177efde83845"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "GET",
+ "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtfsgetfileandsubdirectoryclient&comp=list",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.10.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "c3e0539f-8f88-44f0-9301-b4c2e1a656be"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "retry-after" : "0",
+ "StatusCode" : "200",
+ "x-ms-request-id" : "640875af-d01e-003a-6f5b-e857d8000000",
+ "Body" : "jtfsgetfileandsubdirectoryclientjtfsgetfileandsubdirectoryclient0666514fdd6f3a9f15Mon, 11 Jan 2021 20:48:35 GMT\"0x8D8B672442E282B\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Mon, 11 Jan 2021 20:48:36 GMT",
+ "x-ms-client-request-id" : "c3e0539f-8f88-44f0-9301-b4c2e1a656be",
+ "Content-Type" : "application/xml"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "DELETE",
+ "Uri" : "https://REDACTED.blob.core.windows.net/jtfsgetfileandsubdirectoryclient0666514fdd6f3a9f15?restype=container",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.10.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "3792ad7a-f8e0-4459-ac9b-f7de17d54381"
+ },
+ "Response" : {
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "202",
+ "x-ms-request-id" : "6408762a-d01e-003a-605b-e857d8000000",
+ "Date" : "Mon, 11 Jan 2021 20:48:37 GMT",
+ "x-ms-client-request-id" : "3792ad7a-f8e0-4459-ac9b-f7de17d54381"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ "jtfsgetfileandsubdirectoryclient0666514fdd6f3a9f15", "javapathgetfileandsubdirectoryclient1242530d3d09019a", "javapathgetfileandsubdirectoryclient268667bca3234f49", "javapathgetfileandsubdirectoryclient310511c81b3604ce", "javapathgetfileandsubdirectoryclient424462a215a0ce94" ]
+}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[1].json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[1].json
new file mode 100644
index 0000000000000..7fa0bea6da585
--- /dev/null
+++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[1].json
@@ -0,0 +1,86 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.blob.core.windows.net/jtfsgetfileandsubdirectoryclient092223b7473ffd84a9?restype=container",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.10.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "3689dfa2-9413-4056-ab46-80ae36efe00f"
+ },
+ "Response" : {
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D8B672453F54BD",
+ "Last-Modified" : "Mon, 11 Jan 2021 20:48:37 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "6408765c-d01e-003a-095b-e857d8000000",
+ "Date" : "Mon, 11 Jan 2021 20:48:37 GMT",
+ "x-ms-client-request-id" : "3689dfa2-9413-4056-ab46-80ae36efe00f"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.dfs.core.windows.net/jtfsgetfileandsubdirectoryclient092223b7473ffd84a9/javapathgetfileandsubdirectoryclient1584631ef808625a?resource=directory",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.4.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "053f4dc6-724d-48ee-9f2f-1ce4b9f3fe16"
+ },
+ "Response" : {
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D8B67245534FC5",
+ "Last-Modified" : "Mon, 11 Jan 2021 20:48:37 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "4c80f85a-b01f-005e-4b5b-e8a640000000",
+ "Date" : "Mon, 11 Jan 2021 20:48:37 GMT",
+ "x-ms-client-request-id" : "053f4dc6-724d-48ee-9f2f-1ce4b9f3fe16"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "GET",
+ "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtfsgetfileandsubdirectoryclient&comp=list",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.10.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "6471c8a6-d6ab-482c-af56-7fc2391f14e5"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "retry-after" : "0",
+ "StatusCode" : "200",
+ "x-ms-request-id" : "6408768c-d01e-003a-335b-e857d8000000",
+ "Body" : "jtfsgetfileandsubdirectoryclientjtfsgetfileandsubdirectoryclient092223b7473ffd84a9Mon, 11 Jan 2021 20:48:37 GMT\"0x8D8B672453F54BD\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Mon, 11 Jan 2021 20:48:37 GMT",
+ "x-ms-client-request-id" : "6471c8a6-d6ab-482c-af56-7fc2391f14e5",
+ "Content-Type" : "application/xml"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "DELETE",
+ "Uri" : "https://REDACTED.blob.core.windows.net/jtfsgetfileandsubdirectoryclient092223b7473ffd84a9?restype=container",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.10.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "3c7848b2-265e-4a4a-b78a-b8a891066236"
+ },
+ "Response" : {
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "202",
+ "x-ms-request-id" : "64087695-d01e-003a-3a5b-e857d8000000",
+ "Date" : "Mon, 11 Jan 2021 20:48:37 GMT",
+ "x-ms-client-request-id" : "3c7848b2-265e-4a4a-b78a-b8a891066236"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ "jtfsgetfileandsubdirectoryclient092223b7473ffd84a9", "javapathgetfileandsubdirectoryclient1584631ef808625a", "javapathgetfileandsubdirectoryclient203832f3c79f3223", "javapathgetfileandsubdirectoryclient37667723039e028c", "javapathgetfileandsubdirectoryclient4297577ed7d29e7e" ]
+}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[2].json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[2].json
new file mode 100644
index 0000000000000..cc4476f1b0e0d
--- /dev/null
+++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[2].json
@@ -0,0 +1,86 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.blob.core.windows.net/jtfsgetfileandsubdirectoryclient0986864c201d882b62?restype=container",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.10.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "cb844021-53d8-4480-8236-d3aaed8c7802"
+ },
+ "Response" : {
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D8B6724585E075",
+ "Last-Modified" : "Mon, 11 Jan 2021 20:48:38 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "640876b5-d01e-003a-535b-e857d8000000",
+ "Date" : "Mon, 11 Jan 2021 20:48:37 GMT",
+ "x-ms-client-request-id" : "cb844021-53d8-4480-8236-d3aaed8c7802"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.dfs.core.windows.net/jtfsgetfileandsubdirectoryclient0986864c201d882b62/javapathgetfileandsubdirectoryclient13026056ef99c5d2?resource=directory",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.4.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "ab85e036-cf53-4271-8e94-b79fc59a05a0"
+ },
+ "Response" : {
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D8B67245BC6741",
+ "Last-Modified" : "Mon, 11 Jan 2021 20:48:38 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "4c80f85b-b01f-005e-4c5b-e8a640000000",
+ "Date" : "Mon, 11 Jan 2021 20:48:38 GMT",
+ "x-ms-client-request-id" : "ab85e036-cf53-4271-8e94-b79fc59a05a0"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "GET",
+ "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtfsgetfileandsubdirectoryclient&comp=list",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.10.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "a83baa00-e225-4eef-a15f-e02ec027afce"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "retry-after" : "0",
+ "StatusCode" : "200",
+ "x-ms-request-id" : "640876d6-d01e-003a-6d5b-e857d8000000",
+ "Body" : "jtfsgetfileandsubdirectoryclientjtfsgetfileandsubdirectoryclient0986864c201d882b62Mon, 11 Jan 2021 20:48:38 GMT\"0x8D8B6724585E075\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Mon, 11 Jan 2021 20:48:38 GMT",
+ "x-ms-client-request-id" : "a83baa00-e225-4eef-a15f-e02ec027afce",
+ "Content-Type" : "application/xml"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "DELETE",
+ "Uri" : "https://REDACTED.blob.core.windows.net/jtfsgetfileandsubdirectoryclient0986864c201d882b62?restype=container",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.10.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "0dbfee6f-76b4-4a02-ad06-4e02ed2479ad"
+ },
+ "Response" : {
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "202",
+ "x-ms-request-id" : "640876e7-d01e-003a-7d5b-e857d8000000",
+ "Date" : "Mon, 11 Jan 2021 20:48:38 GMT",
+ "x-ms-client-request-id" : "0dbfee6f-76b4-4a02-ad06-4e02ed2479ad"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ "jtfsgetfileandsubdirectoryclient0986864c201d882b62", "javapathgetfileandsubdirectoryclient13026056ef99c5d2", "javapathgetfileandsubdirectoryclient2472502d96f50b27", "javapathgetfileandsubdirectoryclient343430a8d4a52cb0", "javapathgetfileandsubdirectoryclient4233732a4ae4270d" ]
+}
\ No newline at end of file
diff --git a/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[3].json b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[3].json
new file mode 100644
index 0000000000000..33e006733ff53
--- /dev/null
+++ b/sdk/storage/azure-storage-file-datalake/src/test/resources/session-records/DirectoryAPITestgetfileandsubdirectoryclient[3].json
@@ -0,0 +1,86 @@
+{
+ "networkCallRecords" : [ {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.blob.core.windows.net/jtfsgetfileandsubdirectoryclient02981680e0734dc64c?restype=container",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.10.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "b9985c5b-6e1b-454c-a8b9-45f3d4293eab"
+ },
+ "Response" : {
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D8B67245F55864",
+ "Last-Modified" : "Mon, 11 Jan 2021 20:48:38 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "6408770c-d01e-003a-165b-e857d8000000",
+ "Date" : "Mon, 11 Jan 2021 20:48:38 GMT",
+ "x-ms-client-request-id" : "b9985c5b-6e1b-454c-a8b9-45f3d4293eab"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "PUT",
+ "Uri" : "https://REDACTED.dfs.core.windows.net/jtfsgetfileandsubdirectoryclient02981680e0734dc64c/javapathgetfileandsubdirectoryclient193300037992f98b?resource=directory",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-file-datalake/12.4.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "47ce18c9-1b3b-4ced-9f8a-c782720ce681"
+ },
+ "Response" : {
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0",
+ "ETag" : "0x8D8B672460A7679",
+ "Last-Modified" : "Mon, 11 Jan 2021 20:48:39 GMT",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "201",
+ "x-ms-request-id" : "4c80f85d-b01f-005e-4e5b-e8a640000000",
+ "Date" : "Mon, 11 Jan 2021 20:48:39 GMT",
+ "x-ms-client-request-id" : "47ce18c9-1b3b-4ced-9f8a-c782720ce681"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "GET",
+ "Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtfsgetfileandsubdirectoryclient&comp=list",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.10.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "effe67cb-c35a-4852-80bd-d8b831d33308"
+ },
+ "Response" : {
+ "Transfer-Encoding" : "chunked",
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "retry-after" : "0",
+ "StatusCode" : "200",
+ "x-ms-request-id" : "64087738-d01e-003a-385b-e857d8000000",
+ "Body" : "jtfsgetfileandsubdirectoryclientjtfsgetfileandsubdirectoryclient02981680e0734dc64cMon, 11 Jan 2021 20:48:38 GMT\"0x8D8B67245F55864\"unlockedavailable$account-encryption-keyfalsefalsefalse",
+ "Date" : "Mon, 11 Jan 2021 20:48:38 GMT",
+ "x-ms-client-request-id" : "effe67cb-c35a-4852-80bd-d8b831d33308",
+ "Content-Type" : "application/xml"
+ },
+ "Exception" : null
+ }, {
+ "Method" : "DELETE",
+ "Uri" : "https://REDACTED.blob.core.windows.net/jtfsgetfileandsubdirectoryclient02981680e0734dc64c?restype=container",
+ "Headers" : {
+ "x-ms-version" : "2020-04-08",
+ "User-Agent" : "azsdk-java-azure-storage-blob/12.10.0-beta.2 (11.0.7; Windows 10; 10.0)",
+ "x-ms-client-request-id" : "b5d12323-bb5f-48f5-a734-a6f5700ec786"
+ },
+ "Response" : {
+ "x-ms-version" : "2020-04-08",
+ "Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
+ "retry-after" : "0",
+ "Content-Length" : "0",
+ "StatusCode" : "202",
+ "x-ms-request-id" : "6408773f-d01e-003a-3c5b-e857d8000000",
+ "Date" : "Mon, 11 Jan 2021 20:48:39 GMT",
+ "x-ms-client-request-id" : "b5d12323-bb5f-48f5-a734-a6f5700ec786"
+ },
+ "Exception" : null
+ } ],
+ "variables" : [ "jtfsgetfileandsubdirectoryclient02981680e0734dc64c", "javapathgetfileandsubdirectoryclient193300037992f98b", "javapathgetfileandsubdirectoryclient2003666b45c4bc14", "javapathgetfileandsubdirectoryclient3108093d4fc45e81", "javapathgetfileandsubdirectoryclient487605abbc13799b" ]
+}
\ No newline at end of file