From f37ac2afc53464bce292756fed540fde2a8ca0f7 Mon Sep 17 00:00:00 2001 From: Jonathan Myers Date: Wed, 30 Aug 2023 16:35:37 -0700 Subject: [PATCH] recognize both camelCase and PascalCase keys in file data --- Tasks/DownloadPackageV1/multifilepackage.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Tasks/DownloadPackageV1/multifilepackage.ts b/Tasks/DownloadPackageV1/multifilepackage.ts index d13372920fd2..27ca02bb0829 100644 --- a/Tasks/DownloadPackageV1/multifilepackage.ts +++ b/Tasks/DownloadPackageV1/multifilepackage.ts @@ -55,7 +55,11 @@ export class MultiFilePackage extends Package { } private async getPackageFileContent(fileMetadata: any, feedId: string, project: string, packageMetadata: any): Promise { - if (fileMetadata.protocolMetadata.data.storageId) { + const protocolFileData = fileMetadata.protocolMetadata.data; + + // sometimes the file info has PascalCase keys, sometimes camelCase + const storageId = protocolFileData.storageId || protocolFileData.StorageId; + if (storageId) { tl.debug(`Getting download url for file ${fileMetadata.name}.`) try { @@ -73,14 +77,12 @@ export class MultiFilePackage extends Package { } } - if(fileMetadata.protocolMetadata.data.content) + const content = protocolFileData.content || protocolFileData.Content; + if(content) { tl.debug(`Getting literal content for file ${fileMetadata.name}.`) - return new PackageFileResult( - fileMetadata.name, - fileMetadata.protocolMetadata.data.content, - false); + return new PackageFileResult(fileMetadata.name, content, false); } tl.warning(tl.loc("SkippingFileWithNoContent", fileMetadata.name));