@@ -106,7 +106,7 @@ function Add-PackageSource
106106
107107 $PublishLocation = $Options [$script :PublishLocation ]
108108
109- if (-not (Microsoft.PowerShell.Management\Test-Path $PublishLocation ) -and
109+ if (-not (Microsoft.PowerShell.Management\Test-Path - LiteralPath $PublishLocation ) -and
110110 -not (Test-WebUri - uri $PublishLocation ))
111111 {
112112 $PublishLocationUri = [Uri ]$PublishLocation
@@ -149,7 +149,7 @@ function Add-PackageSource
149149
150150 $ScriptSourceLocation = $Options [$script :ScriptSourceLocation ]
151151
152- if (-not (Microsoft.PowerShell.Management\Test-Path $ScriptSourceLocation ) -and
152+ if (-not (Microsoft.PowerShell.Management\Test-Path - LiteralPath $ScriptSourceLocation ) -and
153153 -not (Test-WebUri - uri $ScriptSourceLocation ))
154154 {
155155 $ScriptSourceLocationUri = [Uri ]$ScriptSourceLocation
@@ -192,7 +192,7 @@ function Add-PackageSource
192192
193193 $ScriptPublishLocation = $Options [$script :ScriptPublishLocation ]
194194
195- if (-not (Microsoft.PowerShell.Management\Test-Path $ScriptPublishLocation ) -and
195+ if (-not (Microsoft.PowerShell.Management\Test-Path - LiteralPath $ScriptPublishLocation ) -and
196196 -not (Test-WebUri - uri $ScriptPublishLocation ))
197197 {
198198 $ScriptPublishLocationUri = [Uri ]$ScriptPublishLocation
@@ -275,7 +275,7 @@ function Add-PackageSource
275275 return
276276 }
277277
278- if (-not (Microsoft.PowerShell.Management\Test-Path - Path $Location ) -and
278+ if (-not (Microsoft.PowerShell.Management\Test-Path - LiteralPath $Location ) -and
279279 -not (Test-WebUri - uri $Location ) )
280280 {
281281 $LocationUri = [Uri ]$Location
@@ -498,7 +498,7 @@ function Add-PackageSource
498498
499499 # ScriptPublishLocation and PublishLocation should be equal in case of SMB Share or Local directory paths
500500 if ($Options.ContainsKey ($script :ScriptPublishLocation ) -and
501- (Microsoft.PowerShell.Management\Test-Path - Path $ScriptPublishLocation ))
501+ (Microsoft.PowerShell.Management\Test-Path - LiteralPath $ScriptPublishLocation ))
502502 {
503503 if ($ScriptPublishLocation -ne $PublishLocation )
504504 {
@@ -521,7 +521,7 @@ function Add-PackageSource
521521 {
522522 # ScriptSourceLocation and SourceLocation cannot be same for they are URLs
523523 # Both should be equal in case of SMB Share or Local directory paths
524- if (Microsoft.PowerShell.Management\Test-Path - Path $ScriptSourceLocation )
524+ if (Microsoft.PowerShell.Management\Test-Path - LiteralPath $ScriptSourceLocation )
525525 {
526526 if ($ScriptSourceLocation -ne $LocationString )
527527 {
@@ -609,4 +609,4 @@ function Add-PackageSource
609609
610610 # return the package source object.
611611 Write-Output - InputObject (New-PackageSourceFromModuleSource - ModuleSource $moduleSource )
612- }
612+ }
0 commit comments