Skip to content

Commit cd97a78

Browse files
authored
[storage-blob] allow empty blobName to support root directory in datalake (Azure#12890)
* allow empty blobName to support root directory in datalake * remove .only * Merge branch 'master' into storage/issues/12813 * changelog
1 parent 736de08 commit cd97a78

File tree

4 files changed

+133
-3
lines changed

4 files changed

+133
-3
lines changed

sdk/storage/storage-blob/src/Clients.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,9 +2451,7 @@ export class BlobClient extends StorageClient {
24512451
// doing the same in the SDK side so that the user doesn't have to replace "\" instances in the blobName
24522452
blobName = blobName.replace(/\\/g, "/");
24532453

2454-
if (!blobName) {
2455-
throw new Error("Provided blobName is invalid.");
2456-
} else if (!containerName) {
2454+
if (!containerName) {
24572455
throw new Error("Provided containerName is invalid.");
24582456
}
24592457

sdk/storage/storage-file-datalake/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 12.3.0-beta.2 (Unreleased)
44

5+
- Now you can get the functionality of the root directory via the `DataLakeDirectoryClient` created via `FileSystemClient.getDirectoryClient("")`. Fixed bug [12813](https://github.com/Azure/azure-sdk-for-js/issues/12813).
56

67
## 12.3.0-beta.1 (2020-12-09)
78

sdk/storage/storage-file-datalake/recordings/node/sas_generation_nodejs_only_for_directory_sas/recording_generatedatalakesasqueryparameters_for_root_directory_should_work.js

Lines changed: 109 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/storage/storage-file-datalake/test/node/sas.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,28 @@ describe("SAS generation Node.js only for directory SAS", () => {
920920
await directoryClientwithSAS.setPermissions(permissions);
921921
});
922922

923+
it("generateDataLakeSASQueryParameters for root directory should work", async () => {
924+
const rootDirName = "";
925+
const rootDirectoryClient = fileSystemClient.getDirectoryClient(rootDirName);
926+
927+
const directorySAS = generateDataLakeSASQueryParameters(
928+
{
929+
fileSystemName: fileSystemClient.name,
930+
pathName: rootDirectoryClient.name,
931+
isDirectory: true,
932+
directoryDepth: 1,
933+
expiresOn: tmr,
934+
permissions: DirectorySASPermissions.parse("racwdlmeop"),
935+
version: "2020-02-10"
936+
},
937+
sharedKeyCredential as StorageSharedKeyCredential
938+
);
939+
const sasURL = `${rootDirectoryClient.url}?${directorySAS}`;
940+
const directoryClientwithSAS = new DataLakeDirectoryClient(sasURL);
941+
942+
await directoryClientwithSAS.getAccessControl();
943+
});
944+
923945
function getDefualtDirctorySAS(directoryName: string): SASQueryParameters {
924946
return generateDataLakeSASQueryParameters(
925947
{

0 commit comments

Comments
 (0)