diff --git a/sdk/storage/storage-file-share/src/ShareClient.ts b/sdk/storage/storage-file-share/src/ShareClient.ts index e64e532ae62c..845092cd10e0 100644 --- a/sdk/storage/storage-file-share/src/ShareClient.ts +++ b/sdk/storage/storage-file-share/src/ShareClient.ts @@ -988,12 +988,22 @@ export class ShareClient extends StorageClient { }; for (const identifier of response) { + let accessPolicy: any = undefined; + if (identifier.accessPolicy) { + accessPolicy = { + permissions: identifier.accessPolicy.permissions + }; + + if (identifier.accessPolicy.expiresOn) { + accessPolicy.expiresOn = new Date(identifier.accessPolicy.expiresOn); + } + + if (identifier.accessPolicy.startsOn) { + accessPolicy.startsOn = new Date(identifier.accessPolicy.startsOn); + } + } res.signedIdentifiers.push({ - accessPolicy: { - expiresOn: new Date(identifier.accessPolicy!.expiresOn!), - permissions: identifier.accessPolicy!.permissions!, - startsOn: new Date(identifier.accessPolicy!.startsOn!) - }, + accessPolicy, id: identifier.id }); }