Skip to content

Commit

Permalink
recognize both camelCase and PascalCase keys in file data
Browse files Browse the repository at this point in the history
  • Loading branch information
jmyersmsft committed Aug 31, 2023
1 parent 378ff9f commit f37ac2a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Tasks/DownloadPackageV1/multifilepackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ export class MultiFilePackage extends Package {
}

private async getPackageFileContent(fileMetadata: any, feedId: string, project: string, packageMetadata: any): Promise<PackageFileResult|null> {
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 {
Expand All @@ -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));
Expand Down

0 comments on commit f37ac2a

Please sign in to comment.