Skip to content

Commit

Permalink
(GH-603) Fix - Get-FileName errors sometimes
Browse files Browse the repository at this point in the history
When running Get-FileName, if HttpWebResponse is not fully qualified,
PowerShell 5 will not know how to find it. It's better to fully qualify
classes, so fix that to be correct.

Also pass along the actual error when it occurs.
  • Loading branch information
ferventcoder committed Feb 4, 2016
1 parent 6dffaff commit 4020dfc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/chocolatey.resources/helpers/functions/Get-FileName.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ param(

try
{
[HttpWebResponse]$response = $request.GetResponse()
[System.Net.HttpWebResponse]$response = $request.GetResponse()
if ($response -eq $null) {
$response.Close()
return $originalFileName
Expand Down Expand Up @@ -134,7 +134,7 @@ param(
{
$request.ServicePoint.MaxIdleTime = 0
$request.Abort();
Write-Debug "Url request/response failed - file name will be '$originalFileName'"
Write-Debug "Url request/response failed - file name will be '$originalFileName': $($_)"

return $originalFileName
}
Expand Down

0 comments on commit 4020dfc

Please sign in to comment.