From 5cc7351b16dcfb1545ffb0b4ee1d24cd34a0f12e Mon Sep 17 00:00:00 2001 From: Gaurav Mantri Date: Mon, 28 Sep 2020 20:49:38 +0530 Subject: [PATCH] Fix for issue #11505 Fixes the issue #11505 (https://github.com/Azure/azure-sdk-for-js/issues/11505) --- .../storage-file-share/src/ShareClient.ts | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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 }); }