Skip to content

Commit c201dee

Browse files
authored
Fix retrieval of organization key (#23)
Due to null check and not a String.IsNullOrWhitespace, the organization key was never properly filled in when using the complete workflow. Changed to String.IsNullOrWhitespace and added extra debuglogging as well.
1 parent c774ad7 commit c201dee

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

Sdk/Tasks/DmappCreation.cs

+19-2
Original file line numberDiff line numberDiff line change
@@ -467,16 +467,33 @@ private void HandleTokens(PackageCreationData packageCreationData)
467467
{
468468
packageCreationData.CatalogDefaultDownloadToken = organizationKey;
469469
}
470+
else
471+
{
472+
Logger.ReportDebug("No value found for CatalogDefaultDownloadKeyName.");
473+
}
474+
}
475+
else
476+
{
477+
Logger.ReportDebug("No CatalogDefaultDownloadKeyName specified. Defaulting back to CatalogPublishKeyName.");
470478
}
471479

472-
// No organization key found, try to fallback to the publish key
473-
if (organizationKey == null && !String.IsNullOrWhiteSpace(CatalogPublishKeyName))
480+
// No organization key found, try to fall back to the publish key
481+
if (String.IsNullOrWhiteSpace(organizationKey) && !String.IsNullOrWhiteSpace(CatalogPublishKeyName))
474482
{
475483
organizationKey = configuration[CatalogPublishKeyName];
476484
if (!String.IsNullOrWhiteSpace(organizationKey))
477485
{
478486
packageCreationData.CatalogDefaultDownloadToken = organizationKey;
479487
}
488+
else
489+
{
490+
Logger.ReportDebug("No value found for CatalogPublishKeyName.");
491+
}
492+
}
493+
494+
if (String.IsNullOrWhiteSpace(organizationKey))
495+
{
496+
Logger.ReportDebug("No organization key could be found. If CatalogReferences are being used, an error will be thrown later in the code.");
480497
}
481498
}
482499

0 commit comments

Comments
 (0)