Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions sdk/storage/storage-file-share/src/Clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ import {
ConvertInternalResponseOfListHandles,
WithResponse,
assertResponse,
removeEmptyString,
} from "./utils/utils.common";
import { Credential } from "../../storage-blob/src/credentials/Credential";
import { StorageSharedKeyCredential } from "../../storage-blob/src/credentials/StorageSharedKeyCredential";
Expand Down Expand Up @@ -2278,10 +2279,13 @@ export class ShareDirectoryClient extends StorageClient {
* Return an AsyncIterableIterator that works a page at a time
*/
byPage: (settings: PageSettings = {}) => {
return this.iterateFilesAndDirectoriesSegments(settings.continuationToken, {
maxResults: settings.maxPageSize,
...updatedOptions,
});
return this.iterateFilesAndDirectoriesSegments(
removeEmptyString(settings.continuationToken),
{
maxResults: settings.maxPageSize,
...updatedOptions,
}
);
},
};
}
Expand Down Expand Up @@ -2470,7 +2474,7 @@ export class ShareDirectoryClient extends StorageClient {
* Return an AsyncIterableIterator that works a page at a time
*/
byPage: (settings: PageSettings = {}) => {
return this.iterateHandleSegments(settings.continuationToken, {
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), {
maxResults: settings.maxPageSize,
...options,
});
Expand Down Expand Up @@ -4883,7 +4887,7 @@ export class ShareFileClient extends StorageClient {
* Return an AsyncIterableIterator that works a page at a time
*/
byPage: (settings: PageSettings = {}) => {
return this.iterateHandleSegments(settings.continuationToken, {
return this.iterateHandleSegments(removeEmptyString(settings.continuationToken), {
maxPageSize: settings.maxPageSize,
...options,
});
Expand Down
3 changes: 2 additions & 1 deletion sdk/storage/storage-file-share/src/ShareServiceClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
appendToURLPath,
extractConnectionStringParts,
assertResponse,
removeEmptyString,
} from "./utils/utils.common";
import { Credential } from "../../storage-blob/src/credentials/Credential";
import { StorageSharedKeyCredential } from "../../storage-blob/src/credentials/StorageSharedKeyCredential";
Expand Down Expand Up @@ -604,7 +605,7 @@ export class ShareServiceClient extends StorageClient {
* Return an AsyncIterableIterator that works a page at a time
*/
byPage: (settings: PageSettings = {}) => {
return this.listSegments(settings.continuationToken, {
return this.listSegments(removeEmptyString(settings.continuationToken), {
maxResults: settings.maxPageSize,
...updatedOptions,
});
Expand Down
11 changes: 11 additions & 0 deletions sdk/storage/storage-file-share/src/utils/utils.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -754,3 +754,14 @@ export function ConvertInternalResponseOfListHandles(

return wrappedResponse;
}

/**
* A small helper to handle converting an empty string "" into undefined
* This is used in the case of query parameters (like continuation token) where
* we don't want to send an empty query parameter to the service since the signing
* policy for shared key will fail.
* @internal
*/
export function removeEmptyString(value: string | undefined): string | undefined {
return value ? value : undefined;
}