Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit 8004c30

Browse files
committed
Merge remote-tracking branch 'origin/development'
2 parents c00f461 + 2c2e910 commit 8004c30

File tree

6 files changed

+43
-11
lines changed

6 files changed

+43
-11
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 2.1.2
4+
5+
New Feature
6+
7+
- Added support for registering repositories with special characters
8+
39
## 2.1.1
410
- Fix DSC resource folder structure
511

SignConfig.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
<file src="__INPATHROOT__\PowerShellGet\DSCResources\MSFT_PSRepository\MSFT_PSRepository.schema.mof" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\DSCResources\MSFT_PSRepository\MSFT_PSRepository.schema.mof" />
1818
<file src="__INPATHROOT__\PowerShellGet\DSCResources\MSFT_PSRepository\en-US\MSFT_PSRepository.strings.psd1" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\DSCResources\MSFT_PSRepository\en-US\MSFT_PSRepository.strings.psd1" />
1919

20-
<file src="__INPATHROOT__\PowerShellGet\Modules\PowerShellGet.LocalizationHelper\PowerShellGet.LocalizationHelper.psm1" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\Modules\PowerShellGet.LocalizationHelper\PowerShellGet.LocalizationHelper.psm1" />
20+
<file src="__INPATHROOT__\PowerShellGet\Modules\PowerShellGet.ResourceHelper\en-US\PowerShellGet.ResourceHelper.strings.psd1" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\Modules\PowerShellGet.ResourceHelper\en-US\PowerShellGet.ResourceHelper.strings.psd1" />
2121
<file src="__INPATHROOT__\PowerShellGet\Modules\PowerShellGet.ResourceHelper\PowerShellGet.ResourceHelper.psm1" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\Modules\PowerShellGet.ResourceHelper\PowerShellGet.ResourceHelper.psm1" />
22+
<file src="__INPATHROOT__\PowerShellGet\Modules\PowerShellGet.LocalizationHelper\PowerShellGet.LocalizationHelper.psm1" signType="AuthenticodeFormer" dest="__OUTPATHROOT__\Modules\PowerShellGet.LocalizationHelper\PowerShellGet.LocalizationHelper.psm1" />
2223
</job>
2324
</SignConfigXML>

Tests/Pester.PSRepository.Tests.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,25 @@ Describe 'Test Register-PSRepository and Register-PackageSource for PSGallery re
6060
$repo.Trusted | should be $true
6161
}
6262

63+
It 'Register-PSRepository File system location with special chars' {
64+
$tmpdir = Join-Path -Path ([System.IO.Path]::GetTempPath()) -ChildPath 'ps repo testing [$!@^&test(;)]'
65+
if (-not (Test-Path -LiteralPath $tmpdir)) {
66+
New-Item -Path $tmpdir -ItemType Directory > $null
67+
}
68+
try {
69+
Register-PSRepository -Name 'Test Repo' -SourceLocation $tmpdir
70+
try {
71+
$repo = Get-PSRepository -Name 'Test Repo'
72+
$repo.Name | should be 'Test Repo'
73+
$repo.SourceLocation | should be $tmpdir
74+
} finally {
75+
Unregister-PSRepository -Name 'Test Repo' -ErrorAction SilentlyContinue
76+
}
77+
} finally {
78+
Remove-Item -LiteralPath $tmpdir -Force -Recurse
79+
}
80+
}
81+
6382
It 'Reregister PSGallery again: Should fail' {
6483
Register-PSRepository -Default
6584
Register-PSRepository -Default -ErrorVariable ev -ErrorAction SilentlyContinue

src/PowerShellGet/PowerShellGet.psd1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@{
22
RootModule = 'PSModule.psm1'
3-
ModuleVersion = '2.1.1'
3+
ModuleVersion = '2.1.2'
44
GUID = '1d73a601-4a6c-43c5-ba3f-619b18bbb404'
55
Author = 'Microsoft Corporation'
66
CompanyName = 'Microsoft Corporation'
@@ -54,6 +54,12 @@
5454
ProjectUri = 'https://go.microsoft.com/fwlink/?LinkId=828955'
5555
LicenseUri = 'https://go.microsoft.com/fwlink/?LinkId=829061'
5656
ReleaseNotes = @'
57+
## 2.1.2
58+
59+
New Feature
60+
61+
- Added support for registering repositories with special characters
62+
5763
## 2.1.1
5864
5965
- Fix DSC resource folder structure

src/PowerShellGet/private/functions/Resolve-Location.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function Resolve-Location
2929
# Ping and resolve the specified location
3030
if(-not (Test-WebUri -uri $Location))
3131
{
32-
if(Microsoft.PowerShell.Management\Test-Path -Path $Location)
32+
if(Microsoft.PowerShell.Management\Test-Path -LiteralPath $Location)
3333
{
3434
return $Location
3535
}
@@ -77,4 +77,4 @@ function Resolve-Location
7777
-ExceptionObject $Location
7878
}
7979
}
80-
}
80+
}

src/PowerShellGet/public/providerfunctions/Add-PackageSource.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)