@azure/storage-file-share 12.11.1-alpha.20220923.1 → 12.11.1-alpha.20221013.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
@@ -875,6 +875,16 @@ function setURLQueries(url, queryString) {
875
875
  urlParsed.setQuery(queryString);
876
876
  return urlParsed.toString();
877
877
  }
878
+ /**
879
+ * Escape the file or directory name but keep path separator ('/').
880
+ */
881
+ function EscapePath(pathName) {
882
+ const split = pathName.split("/");
883
+ for (let i = 0; i < split.length; i++) {
884
+ split[i] = encodeURIComponent(split[i]);
885
+ }
886
+ return split.join("/");
887
+ }
878
888
 
879
889
  // Copyright (c) Microsoft Corporation.
880
890
  /**
@@ -11807,7 +11817,7 @@ class ShareClient extends StorageClient {
11807
11817
  // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
11808
11818
  /* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
11809
11819
  getDirectoryClient(directoryName) {
11810
- return new ShareDirectoryClient(appendToURLPath(this.url, encodeURIComponent(directoryName)), this.pipeline);
11820
+ return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(directoryName)), this.pipeline);
11811
11821
  }
11812
11822
  /**
11813
11823
  * Gets the directory client for the root directory of this share.
@@ -12507,7 +12517,7 @@ class ShareDirectoryClient extends StorageClient {
12507
12517
  * ```
12508
12518
  */
12509
12519
  getDirectoryClient(subDirectoryName) {
12510
- return new ShareDirectoryClient(appendToURLPath(this.url, encodeURIComponent(subDirectoryName)), this.pipeline);
12520
+ return new ShareDirectoryClient(appendToURLPath(this.url, EscapePath(subDirectoryName)), this.pipeline);
12511
12521
  }
12512
12522
  /**
12513
12523
  * Creates a new subdirectory under this directory.
@@ -12652,7 +12662,7 @@ class ShareDirectoryClient extends StorageClient {
12652
12662
  // Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
12653
12663
  /* eslint-disable-next-line @azure/azure-sdk/ts-naming-subclients */
12654
12664
  getFileClient(fileName) {
12655
- return new ShareFileClient(appendToURLPath(this.url, encodeURIComponent(fileName)), this.pipeline);
12665
+ return new ShareFileClient(appendToURLPath(this.url, EscapePath(fileName)), this.pipeline);
12656
12666
  }
12657
12667
  /**
12658
12668
  * Returns true if the specified directory exists; false otherwise.
@@ -13318,13 +13328,13 @@ class ShareDirectoryClient extends StorageClient {
13318
13328
  const split = destinationPath.split("?");
13319
13329
  let destinationUrl;
13320
13330
  if (split.length === 2) {
13321
- const pathOnly = encodeURIComponent(split[0]);
13331
+ const pathOnly = EscapePath(split[0]);
13322
13332
  const renameDestination = `/${this.shareName}/${pathOnly}`;
13323
13333
  destinationUrl = setURLPath(this.url, renameDestination);
13324
13334
  destinationUrl = setURLQueries(destinationUrl, split[1]);
13325
13335
  }
13326
13336
  else if (split.length === 1) {
13327
- const pathOnly = encodeURIComponent(destinationPath);
13337
+ const pathOnly = EscapePath(destinationPath);
13328
13338
  const renameDestination = `/${this.shareName}/${pathOnly}`;
13329
13339
  destinationUrl = setURLPath(this.url, renameDestination);
13330
13340
  }
@@ -14726,13 +14736,13 @@ class ShareFileClient extends StorageClient {
14726
14736
  const split = destinationPath.split("?");
14727
14737
  let destinationUrl;
14728
14738
  if (split.length === 2) {
14729
- const pathOnly = encodeURIComponent(split[0]);
14739
+ const pathOnly = EscapePath(split[0]);
14730
14740
  const renameDestination = `/${this.shareName}/${pathOnly}`;
14731
14741
  destinationUrl = setURLPath(this.url, renameDestination);
14732
14742
  destinationUrl = setURLQueries(destinationUrl, split[1]);
14733
14743
  }
14734
14744
  else if (split.length === 1) {
14735
- const pathOnly = encodeURIComponent(destinationPath);
14745
+ const pathOnly = EscapePath(destinationPath);
14736
14746
  const renameDestination = `/${this.shareName}/${pathOnly}`;
14737
14747
  destinationUrl = setURLPath(this.url, renameDestination);
14738
14748
  }