From 06d018c7a6abd4657f0b057a31358e008de3dcb1 Mon Sep 17 00:00:00 2001 From: PARAMESHO Date: Wed, 2 Jan 2019 21:55:26 +0530 Subject: [PATCH] Set-HVApplicationIcon not behaving correctly with .ico and .bmp files When bmp/ico image files are used as customized application icons, short cuts feature on Horizon Client is facing the issues in rendering. Bug 2168320 has been reported for this issue. We have decided to block all the non-png image files for the customization of application icons. Testing: Tested with the changes. Working as expected. Refer review https://reviewboard.eng.vmware.com/r/1446121 for more details. --- Modules/VMware.Hv.Helper/VMware.HV.Helper.psm1 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Modules/VMware.Hv.Helper/VMware.HV.Helper.psm1 b/Modules/VMware.Hv.Helper/VMware.HV.Helper.psm1 index 5b68b9f..7717e40 100644 --- a/Modules/VMware.Hv.Helper/VMware.HV.Helper.psm1 +++ b/Modules/VMware.Hv.Helper/VMware.HV.Helper.psm1 @@ -8819,6 +8819,16 @@ function Set-HVApplicationIcon { } process { + if (!(Test-Path $IconPath)) { + Write-Error "File:[$IconPath] does not exist." + break + } + + if ([IO.Path]::GetExtension($IconPath) -ne '.png') { + Write-Error "Unsupported file format:[$IconPath]. Only PNG image files are supported." + break + } + try { $appInfo = Get-HVQueryResult -EntityType ApplicationInfo -Filter (Get-HVQueryFilter data.name -Eq $ApplicationName) -HvServer $HvServer } catch { @@ -8832,11 +8842,6 @@ function Set-HVApplicationIcon { break } - if (!(Test-Path $IconPath)) { - Write-Error "File:[$IconPath] does not exists" - break - } - $spec = New-Object VMware.Hv.ApplicationIconSpec $base = New-Object VMware.Hv.ApplicationIconBase