diff --git a/Packs/Base/ReleaseNotes/1_3_33.md b/Packs/Base/ReleaseNotes/1_3_33.md new file mode 100644 index 00000000000..28a40da961b --- /dev/null +++ b/Packs/Base/ReleaseNotes/1_3_33.md @@ -0,0 +1,5 @@ + +#### Scripts +##### CommonServerPowerShell +- Fixed a bug in **TableToMarkdown** where boolean values of *False* were not shown. +- Fixed parsing of nested lists in **TableToMarkdown**. diff --git a/Packs/Base/Scripts/CommonServerPowerShell/CommonServerPowerShell.Tests.ps1 b/Packs/Base/Scripts/CommonServerPowerShell/CommonServerPowerShell.Tests.ps1 index 20db0a4459d..5b163474e55 100644 --- a/Packs/Base/Scripts/CommonServerPowerShell/CommonServerPowerShell.Tests.ps1 +++ b/Packs/Base/Scripts/CommonServerPowerShell/CommonServerPowerShell.Tests.ps1 @@ -146,6 +146,13 @@ Describe 'Check-UtilityFunctions' { It "Check with a list of hashtables"{ $HashTableWithOneEntry | TableToMarkdown | Should -Be "| Index | Name`n| --- | ---`n| 0 | First element`n" } + It "Check with False boolean that is not $null" { + @{test=$false} | TableToMarkdown | Should -Be "| test`n| ---`n| False`n" + } + It "Check with PSObject that nested list" { + $OneElementObject += New-Object PSObject -Property @{Index=1;Name=@('test1';'test2')} + $OneElementObject | TableToMarkdown | Should -Be "| Index | Name`n| --- | ---`n| 0 | First element`n| 1 | \[`"test1`",`"test2`"\]`n" + } } Context "Test stringEscapeMD" { diff --git a/Packs/Base/Scripts/CommonServerPowerShell/CommonServerPowerShell.ps1 b/Packs/Base/Scripts/CommonServerPowerShell/CommonServerPowerShell.ps1 index 5e963d03269..d6a84e8315e 100644 --- a/Packs/Base/Scripts/CommonServerPowerShell/CommonServerPowerShell.ps1 +++ b/Packs/Base/Scripts/CommonServerPowerShell/CommonServerPowerShell.ps1 @@ -487,6 +487,11 @@ Function TableToMarkdown{ # Need to convert hashtables to ordered dicts so that the keys/values will be in the same order $item = $item | ConvertTo-OrderedDict } + elseif ($item -Is [PsCustomObject]){ + $newItem = @{} + $item.PSObject.Properties | ForEach-Object { $newItem[$_.Name] = $_.Value } + $item = $newItem | ConvertTo-OrderedDict + } $items += $item } } @@ -527,7 +532,7 @@ End { } foreach ($raw_value in $raw_values) { - if ($raw_value) + if ($null -ne $raw_value) { if ($raw_value -Is [System.Array] -Or $raw_value -Is [Collections.IDictionary] -Or $raw_value -Is [PSCustomObject]) { diff --git a/Packs/Base/pack_metadata.json b/Packs/Base/pack_metadata.json index 9079c700f31..3c4c4ae6b5b 100644 --- a/Packs/Base/pack_metadata.json +++ b/Packs/Base/pack_metadata.json @@ -2,7 +2,7 @@ "name": "Base", "description": "The base pack for Cortex XSOAR.", "support": "xsoar", - "currentVersion": "1.3.32", + "currentVersion": "1.3.33", "author": "Cortex XSOAR", "url": "https://www.paloaltonetworks.com/cortex", "email": "",