From c873be53bbfa24c2cf6f7e93c75d65cf77f5767d Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Thu, 2 Feb 2017 23:42:38 -0600 Subject: [PATCH 1/2] (doc) Note PowerShell period limitation Literal periods don't always work out well when specified on the path with PowerShell. It has a tendency to take `some.value` and make it `some .value`. Note that limitation in the how to pass options documentation. --- .../infrastructure.app/builders/ConfigurationBuilder.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs index 644929f9d9..638d85afc2 100644 --- a/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs +++ b/src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs @@ -416,6 +416,9 @@ the local options are parsed. (`` `""value`"" ``) or apostrophes (`'value'`). Using the combination allows for both shells to work without issue, except for when the next section applies. + * **Periods in PowerShell**: If you need to pass a period as part of a + value or a path, PowerShell doesn't always handle it well. Please + quote those values using ""Quote Values"" section above. * **Pass quotes in arguments**: When you need to pass quoted values to to something like a native installer, you are in for a world of fun. In cmd.exe you must pass it like this: `-ia ""/yo=""""Spaces spaces""""""`. In From eb395365078d51b500451656276c1fc025629708 Mon Sep 17 00:00:00 2001 From: Brian Lalonde Date: Wed, 18 Jan 2017 15:47:45 -0800 Subject: [PATCH 2/2] (GH-1141) Fix: Constant Proxy Null Reference Error In some environments, (new-object System.Net.WebClient).Proxy -eq $null is true, as is [System.Net.WebRequest]::DefaultWebProxy -eq $null. This means the IsBypassed() method was being called on a null object. This checks the object's existence before using that method. --- src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 | 2 +- src/chocolatey.resources/helpers/functions/Get-WebFileName.ps1 | 2 +- src/chocolatey.resources/helpers/functions/Get-WebHeaders.ps1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 b/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 index e3048185e1..833d79e801 100644 --- a/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-WebFile.ps1 @@ -133,7 +133,7 @@ param( Write-Host "Using explicit proxy server '$explicitProxy'." $req.Proxy = $proxy - } elseif (!$webclient.Proxy.IsBypassed($url)) + } elseif ($webclient.Proxy -and !$webclient.Proxy.IsBypassed($url)) { # system proxy (pass through) $creds = [net.CredentialCache]::DefaultCredentials diff --git a/src/chocolatey.resources/helpers/functions/Get-WebFileName.ps1 b/src/chocolatey.resources/helpers/functions/Get-WebFileName.ps1 index 74b943af44..4b72852a42 100644 --- a/src/chocolatey.resources/helpers/functions/Get-WebFileName.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-WebFileName.ps1 @@ -130,7 +130,7 @@ param( Write-Debug "Using explicit proxy server '$explicitProxy'." $request.Proxy = $proxy - } elseif (!$client.Proxy.IsBypassed($url)) + } elseif ($client.Proxy -and !$client.Proxy.IsBypassed($url)) { # system proxy (pass through) $creds = [Net.CredentialCache]::DefaultCredentials diff --git a/src/chocolatey.resources/helpers/functions/Get-WebHeaders.ps1 b/src/chocolatey.resources/helpers/functions/Get-WebHeaders.ps1 index 7d699caabd..9480876e1b 100644 --- a/src/chocolatey.resources/helpers/functions/Get-WebHeaders.ps1 +++ b/src/chocolatey.resources/helpers/functions/Get-WebHeaders.ps1 @@ -87,7 +87,7 @@ param( Write-Host "Using explicit proxy server '$explicitProxy'." $request.Proxy = $proxy - } elseif (!$client.Proxy.IsBypassed($url)) + } elseif ($client.Proxy -and !$client.Proxy.IsBypassed($url)) { # system proxy (pass through) $creds = [Net.CredentialCache]::DefaultCredentials