@azure/storage-file-share 12.20.0-alpha.20230727.2 → 12.20.0-alpha.20230802.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -340,7 +340,7 @@ function ipRangeToString(ipRange) {
340
340
  // Copyright (c) Microsoft Corporation.
341
341
  // Licensed under the MIT license.
342
342
  const SDK_VERSION$1 = "12.20.0";
343
- const SERVICE_VERSION = "2022-11-02";
343
+ const SERVICE_VERSION = "2023-01-03";
344
344
  const FILE_MAX_SIZE_BYTES = 4 * 1024 * 1024 * 1024 * 1024; // 4TB
345
345
  const FILE_RANGE_MAX_SIZE_BYTES = 4 * 1024 * 1024; // 4MB
346
346
  const DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS = 5;
@@ -503,7 +503,11 @@ function extractConnectionStringParts(connectionString) {
503
503
  else {
504
504
  // SAS connection string
505
505
  const accountSas = getValueInConnString(connectionString, "SharedAccessSignature");
506
- const accountName = getAccountNameFromUrl(fileEndpoint);
506
+ let accountName = getValueInConnString(connectionString, "AccountName");
507
+ // if accountName is empty, try to read it from BlobEndpoint
508
+ if (!accountName) {
509
+ accountName = getAccountNameFromUrl(fileEndpoint);
510
+ }
507
511
  if (!fileEndpoint) {
508
512
  throw new Error("Invalid FileEndpoint in the provided SAS Connection String");
509
513
  }
@@ -638,10 +642,10 @@ function getAccountNameFromUrl(url) {
638
642
  function isIpEndpointStyle(parsedUrl) {
639
643
  const host = parsedUrl.host;
640
644
  // Case 1: Ipv6, use a broad regex to find out candidates whose host contains two ':'.
641
- // Case 2: localhost(:port), use broad regex to match port part.
645
+ // Case 2: localhost(:port) or host.docker.internal, use broad regex to match port part.
642
646
  // Case 3: Ipv4, use broad regex which just check if host contains Ipv4.
643
647
  // For valid host please refer to https://man7.org/linux/man-pages/man7/hostname.7.html.
644
- return (/^.*:.*:.*$|^localhost(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(host) ||
648
+ return (/^.*:.*:.*$|^(localhost|host.docker.internal)(:[0-9]+)?$|^(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])){3}(:[0-9]+)?$/.test(host) ||
645
649
  (Boolean(parsedUrl.port) && PathStylePorts.includes(parsedUrl.port)));
646
650
  }
647
651
  function getShareNameAndPathFromUrl(url) {
@@ -784,6 +788,16 @@ function ConvertInternalResponseOfListHandles(internalResponse) {
784
788
  : undefined });
785
789
  return wrappedResponse;
786
790
  }
791
+ /**
792
+ * A small helper to handle converting an empty string "" into undefined
793
+ * This is used in the case of query parameters (like continuation token) where
794
+ * we don't want to send an empty query parameter to the service since the signing
795
+ * policy for shared key will fail.
796
+ * @internal
797
+ */
798
+ function removeEmptyString(value) {
799
+ return value ? value : undefined;
800
+ }
787
801
 
788
802
  // Copyright (c) Microsoft Corporation.
789
803
  /**
@@ -13306,7 +13320,7 @@ class ShareDirectoryClient extends StorageClient {
13306
13320
  * Return an AsyncIterableIterator that works a page at a time
13307
13321
  */
13308
13322
  byPage: (settings = {}) => {
13309
- return this.iterateFilesAndDirectoriesSegments(settings.continuationToken, Object.assign({ maxResults: settings.maxPageSize }, updatedOptions));
13323
+ return this.iterateFilesAndDirectoriesSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxResults: settings.maxPageSize }, updatedOptions));
13310
13324
  },
13311
13325
  };
13312
13326
  }
@@ -13482,7 +13496,7 @@ class ShareDirectoryClient extends StorageClient {
13482
13496
  * Return an AsyncIterableIterator that works a page at a time
13483
13497
  */
13484
13498
  byPage: (settings = {}) => {
13485
- return this.iterateHandleSegments(settings.continuationToken, Object.assign({ maxResults: settings.maxPageSize }, options));
13499
+ return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxResults: settings.maxPageSize }, options));
13486
13500
  },
13487
13501
  };
13488
13502
  }
@@ -14567,7 +14581,7 @@ class ShareFileClient extends StorageClient {
14567
14581
  * Return an AsyncIterableIterator that works a page at a time
14568
14582
  */
14569
14583
  byPage: (settings = {}) => {
14570
- return this.iterateHandleSegments(settings.continuationToken, Object.assign({ maxPageSize: settings.maxPageSize }, options));
14584
+ return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxPageSize: settings.maxPageSize }, options));
14571
14585
  },
14572
14586
  };
14573
14587
  }
@@ -15156,7 +15170,7 @@ class ShareServiceClient extends StorageClient {
15156
15170
  * Return an AsyncIterableIterator that works a page at a time
15157
15171
  */
15158
15172
  byPage: (settings = {}) => {
15159
- return this.listSegments(settings.continuationToken, Object.assign({ maxResults: settings.maxPageSize }, updatedOptions));
15173
+ return this.listSegments(removeEmptyString(settings.continuationToken), Object.assign({ maxResults: settings.maxPageSize }, updatedOptions));
15160
15174
  },
15161
15175
  };
15162
15176
  }