Skip to content

Commit

Permalink
(GH-871) Fix - Uninstall zip: Path is empty string
Browse files Browse the repository at this point in the history
When calling Uninstall-ChocolateyZipPackage, the text file may have an
empty string at the end of the file. This line should be skipped and
not tried to remove. Even though the ErrorAction is to
SilentlyContinue, it will fail if the arguments are not correct.
  • Loading branch information
ferventcoder committed Jul 24, 2016
1 parent f0dd88e commit 5664ef3
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ param(
if ((Test-Path -path $zipContentFile)) {
$zipContentFile
$zipContents=get-content $zipContentFile
foreach ($fileInZip in $zipContents) {
remove-item -Path "$fileInZip" -ErrorAction SilentlyContinue -Recurse -Force
foreach ($fileInZip in $zipContents) {
if ($fileInZip -ne $null -and $fileInZip.Trim() -ne '') {
Remove-Item -Path "$fileInZip" -ErrorAction SilentlyContinue -Recurse -Force
}
}
}
}

0 comments on commit 5664ef3

Please sign in to comment.