@@ -884,19 +884,19 @@ public static bool TryConvertFromContainerRegistryJson(
884
884
metadata [ "NormalizedVersion" ] = parsedNormalizedVersion . ToNormalizedString ( ) ;
885
885
886
886
// License Url
887
- if ( rootDom . TryGetProperty ( "LicenseUrl" , out JsonElement licenseUrlElement ) || rootDom . TryGetProperty ( "licenseUrl" , out licenseUrlElement ) || rootDom . TryGetProperty ( "LicenseUri" , out licenseUrlElement ) )
887
+ if ( rootDom . TryGetProperty ( "LicenseUrl" , out JsonElement licenseUrlElement ) || rootDom . TryGetProperty ( "licenseUrl" , out licenseUrlElement ) )
888
888
{
889
889
metadata [ "LicenseUrl" ] = ParseHttpUrl ( licenseUrlElement . ToString ( ) ) as Uri ;
890
890
}
891
891
892
892
// Project Url
893
- if ( rootDom . TryGetProperty ( "ProjectUrl" , out JsonElement projectUrlElement ) || rootDom . TryGetProperty ( "projectUrl" , out projectUrlElement ) || rootDom . TryGetProperty ( "ProjectUri" , out projectUrlElement ) )
893
+ if ( rootDom . TryGetProperty ( "ProjectUrl" , out JsonElement projectUrlElement ) || rootDom . TryGetProperty ( "projectUrl" , out projectUrlElement ) )
894
894
{
895
895
metadata [ "ProjectUrl" ] = ParseHttpUrl ( projectUrlElement . ToString ( ) ) as Uri ;
896
896
}
897
897
898
898
// Icon Url
899
- if ( rootDom . TryGetProperty ( "IconUrl" , out JsonElement iconUrlElement ) || rootDom . TryGetProperty ( "iconUrl" , out iconUrlElement ) || rootDom . TryGetProperty ( "IconUri" , out iconUrlElement ) )
899
+ if ( rootDom . TryGetProperty ( "IconUrl" , out JsonElement iconUrlElement ) || rootDom . TryGetProperty ( "iconUrl" , out iconUrlElement ) )
900
900
{
901
901
metadata [ "IconUrl" ] = ParseHttpUrl ( iconUrlElement . ToString ( ) ) as Uri ;
902
902
}
@@ -995,17 +995,17 @@ public static bool TryConvertFromContainerRegistryJson(
995
995
if ( rootDom . TryGetProperty ( "PrivateData" , out JsonElement privateDataElement ) && privateDataElement . TryGetProperty ( "PSData" , out JsonElement psDataElement ) )
996
996
{
997
997
// some properties that may be in PrivateData.PSData: LicenseUri, ProjectUri, IconUri, ReleaseNotes
998
- if ( ! ( metadata . ContainsKey ( "LicenseUrl" ) || metadata . ContainsKey ( "licenseUrl" ) ) && psDataElement . TryGetProperty ( "LicenseUri" , out JsonElement psDataLicenseUriElement ) )
998
+ if ( ! metadata . ContainsKey ( "LicenseUrl" ) && psDataElement . TryGetProperty ( "LicenseUri" , out JsonElement psDataLicenseUriElement ) )
999
999
{
1000
1000
metadata [ "LicenseUrl" ] = ParseHttpUrl ( psDataLicenseUriElement . ToString ( ) ) as Uri ;
1001
1001
}
1002
1002
1003
- if ( ! ( metadata . ContainsKey ( "ProjectUrl" ) || metadata . ContainsKey ( "ProjectUrl" ) ) && psDataElement . TryGetProperty ( "ProjectUri" , out JsonElement psDataProjectUriElement ) )
1003
+ if ( ! metadata . ContainsKey ( "ProjectUrl" ) && psDataElement . TryGetProperty ( "ProjectUri" , out JsonElement psDataProjectUriElement ) )
1004
1004
{
1005
1005
metadata [ "ProjectUrl" ] = ParseHttpUrl ( psDataProjectUriElement . ToString ( ) ) as Uri ;
1006
1006
}
1007
1007
1008
- if ( ! ( metadata . ContainsKey ( "IconUrl" ) || metadata . ContainsKey ( "IconUrl" ) ) && psDataElement . TryGetProperty ( "IconUri" , out JsonElement psDataIconUriElement ) )
1008
+ if ( ! metadata . ContainsKey ( "IconUrl" ) && psDataElement . TryGetProperty ( "IconUri" , out JsonElement psDataIconUriElement ) )
1009
1009
{
1010
1010
metadata [ "IconUrl" ] = ParseHttpUrl ( psDataIconUriElement . ToString ( ) ) as Uri ;
1011
1011
}
@@ -1014,6 +1014,29 @@ public static bool TryConvertFromContainerRegistryJson(
1014
1014
{
1015
1015
metadata [ "ReleaseNotes" ] = psDataReleaseNotesElement . ToString ( ) ;
1016
1016
}
1017
+
1018
+ if ( ! metadata . ContainsKey ( "Tags" ) && psDataElement . TryGetProperty ( "Tags" , out JsonElement psDataTagsElement ) )
1019
+ {
1020
+ string [ ] pkgTags = Utils . EmptyStrArray ;
1021
+ if ( psDataTagsElement . ValueKind == JsonValueKind . Array )
1022
+ {
1023
+ var arrayLength = psDataTagsElement . GetArrayLength ( ) ;
1024
+ List < string > tags = new List < string > ( arrayLength ) ;
1025
+ foreach ( var tag in psDataTagsElement . EnumerateArray ( ) )
1026
+ {
1027
+ tags . Add ( tag . ToString ( ) ) ;
1028
+ }
1029
+
1030
+ pkgTags = tags . ToArray ( ) ;
1031
+ }
1032
+ else if ( psDataTagsElement . ValueKind == JsonValueKind . String )
1033
+ {
1034
+ string tagStr = psDataTagsElement . ToString ( ) ;
1035
+ pkgTags = tagStr . Split ( Utils . WhitespaceSeparator , StringSplitOptions . RemoveEmptyEntries ) ;
1036
+ }
1037
+
1038
+ metadata [ "Tags" ] = pkgTags ;
1039
+ }
1017
1040
}
1018
1041
1019
1042
var additionalMetadataHashtable = new Dictionary < string , string >
0 commit comments