Stephanevg / PSHTML

Cross platform Powershell module to generate HTML markup language
https://pshtml.readthedocs.io/en/latest/
Other
168 stars 43 forks source link

Bug in ConvertTo-HTMLTable - Set-HTMLTag #206

Closed LxLeChat closed 5 years ago

LxLeChat commented 5 years ago

Subject of the issue

Their might be a problem when converting an object using ConvertTo-HTMLTable. When an object contains boolean values, and this values are $False, the content of the corresponding TD is empty. While when the value is $True, the content of the correspondind correctly display "True". The problem must come from the set-htmltag function.

Steps to reproduce

ConvertTo-HTMLTable -object $(new-object -typename psobject -property @{a='aaaa';b=$false})

Expected behaviour

the content of the html output should look like this: <td >aaaa</td><td >False</td>

Actual behaviour

<td >aaaa</td><td ></td> The content of the second TD is empty, whil it should contain False

LxLeChat commented 5 years ago

the bug is located in the set-htmltag private function.

if($outcontent){ $TagContent = -join $outcontent }

If your content is a $false bolean, it wont work.. ! as seen together, if you implement the following code it should work

if($null -ne $outcontent){ $TagContent = -join $outcontent }