8000 [Feature] Merge branch 'master' of https://github.com/kalgiz/PowerShe… · kalgiz/PowerShell@c2525a8 · GitHub
[go: up one dir, main page]

Skip to content

Commit c2525a8

Browse files
committed
[Feature] Merge branch 'master' of https://github.com/kalgiz/PowerShell into pester-parameter-syntax-engine
2 parents 5092da7 + 2d58072 commit c2525a8

File tree

5 files changed

+31
-21
lines changed

5 files changed

+31
-21
lines changed

build.psm1

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,17 +526,16 @@ Fix steps:
526526

527527
# handle Restore
528528
if ($Restore -or -not (Test-Path "$($Options.Top)/obj/project.assets.json")) {
529-
$srcProjectDirs = @($Options.Top, "$PSScriptRoot/src/TypeCatalogGen", "$PSScriptRoot/src/ResGen", "$PSScriptRoot/src/Modules/PSGalleryModules.csproj")
530-
$testProjectDirs = Get-ChildItem "$PSScriptRoot/test/*.csproj" -Recurse | ForEach-Object { [System.IO.Path]::GetDirectoryName($_) }
529+
$srcProjectDirs = @($Options.Top, "$PSScriptRoot/src/TypeCatalogGen", "$PSScriptRoot/src/ResGen", "$PSScriptRoot/src/Modules")
531530

532-
$RestoreArguments = @("--verbosity")
531+
$RestoreArguments = @("--runtime",$Options.Runtime,"--verbosity")
533532
if ($PSCmdlet.MyInvocation.BoundParameters["Verbose"].IsPresent) {
534533
$RestoreArguments += "detailed"
535534
} else {
536535
$RestoreArguments += "quiet"
537536
}
538537

539-
($srcProjectDirs + $testProjectDirs) | ForEach-Object {
538+
$srcProjectDirs | ForEach-Object {
540539
Write-Log "Run dotnet restore $_ $RestoreArguments"
541540
Start-NativeExecution { dotnet restore $_ $RestoreArguments }
542541
}

src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1616,7 +1616,8 @@ internal void ParseLinkHeader(HttpResponseMessage response, System.Uri requestUr
16161616
{
16171617
if (_relationLink == null)
16181618
{
1619-
_relationLink = new Dictionary<string, string>();
1619+
// Must ignore the case of relation links. See RFC 8288 (https://tools.ietf.org/html/rfc8288)
1620+
_relationLink = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
16201621
}
16211622
else
16221623
{

test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,28 @@ Describe "Invoke-WebRequest tests" -Tags "Feature" {
733733
$result.Output.RelationLink["self"] | Should -BeExactly "${baseUri}?maxlinks=5&linknumber=2&type=multiple"
734734
}
735735

736+
737+
It "Validate Invoke-WebRequest RelationLink keys are treated case-insensitively" {
738+
$uri = Get-WebListenerUrl -Test 'Link' -Query @{maxlinks = 5; linknumber = 2; type = 'multiple'}
739+
$command = "Invoke-WebRequest -Uri '$uri'"
740+
$result = ExecuteWebCommand -command $command
741+
742+
$result.Output.RelationLink["next"] | Should -Not -BeNullOrEmpty
743+
$result.Output.RelationLink["next"] | Should -BeExactly $result.Output.RelationLink["Next"]
744+
745+
$result.Output.RelationLink["last"] | Should -Not -BeNullOrEmpty
746+
$result.Output.RelationLink["last"] | Should -BeExactly $result.Output.RelationLink["LAST"]
747+
748+
$result.Output.RelationLink["prev"] | Should -Not -BeNullOrEmpty
749+
$result.Output.RelationLink["prev"] | Should -BeExactly $result.Output.RelationLink["preV"]
750+
751+
$result.Output.RelationLink["first"] | Should -Not -BeNullOrEmpty
752+
$result.Output.RelationLink["first"] | Should -BeExactly $result.Output.RelationLink["FiRsT"]
753+
754+
$result.Output.RelationLink["self"] | Should -Not -BeNullOrEmpty
755+
$result.Output.RelationLink["self"] | Should -BeExactly $result.Output.RelationLink["self"]
756+
}
757+
736758
It "Validate Invoke-WebRequest quietly ignores invalid Link Headers in RelationLink property: <type>" -TestCases @(
737759
@{ type = "noUrl" }
738760
@{ type = "malformed" }

tools/appveyor.psm1

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ function Get-ReleaseTag
446446
# Implements AppVeyor 'on_finish' step
447447
function Invoke-AppveyorFinish
448448
{
449-
$exitCode = 0
450449
try {
451450
$releaseTag = Get-ReleaseTag
452451

@@ -455,8 +454,6 @@ function Invoke-AppveyorFinish
455454

456455
# Build packages
457456
$packages = Start-PSPackage -Type msi,nupkg,zip -ReleaseTag $releaseTag -SkipReleaseChecks
458-
$msiObject = $packages | Where-Object { $_ -is [pscustomobject] -and $_.msi }
459-
$msi = $msiObject | Where-Object { $_.msi.EndsWith(".msi") } | Select-Object -ExpandProperty msi
460457

461458
$artifacts = New-Object System.Collections.ArrayList
462459
foreach ($package in $packages) {
@@ -490,7 +487,7 @@ function Invoke-AppveyorFinish
490487
}
491488

492489
# Smoke Test MSI installer
493-
log "Smoke-Testing MSI installer"
490+
Write-Log "Smoke-Testing MSI installer"
494491
$msi = $artifacts | Where-Object { $_.EndsWith(".msi")}
495492
$msiLog = Join-Path (Get-Location) 'msilog.txt'
496493
$msiExecProcess = Start-Process msiexec.exe -Wait -ArgumentList "/I $msi /quiet /l*vx $msiLog" -NoNewWindow -PassThru
@@ -500,8 +497,7 @@ function Invoke-AppveyorFinish
500497
$exitCode = $msiExecProcess.ExitCode
501498
throw "MSI installer failed and returned error code $exitCode. MSI Log was uploaded as artifact."
502499
}
503-
504-
log "MSI smoke test was successful"
500+
Write-Log "MSI smoke test was successful"
505501

506502
# only publish assembly nuget packages if it is a daily build and tests passed
507503
if((Test-DailyBuild) -and $env:TestPassed -eq 'True')
@@ -555,14 +551,6 @@ function Invoke-AppveyorFinish
555551
}
556552
catch {
557553
Write-Host -Foreground Red $_
558-
}
559-
finally {
560-
# A throw statement would not make the build fail. This function is AppVeyor specific
561-
# and is the only command executed in 'on_finish' phase, so it's safe that we request
562-
# the current runspace to exit with the specified exit code. If the exit code is non-zero,
563-
# AppVeyor will fail the build.
564-
# See this link for details:
565-
# https://help.appveyor.com/discussions/problems/4498-powershell-exception-in-test_script-does-not-fail-build
566-
$host.SetShouldExit($exitCode)
554+
throw $_
567555
}
568556
}

tools/packaging/packaging.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2286,7 +2286,7 @@ function Test-FileWxs
22862286
}
22872287
catch
22882288
{
2289-
#ignore any error pushing the artifact
2289+
Write-Warning -Message "Pushing MSI File fragment failed."
22902290
}
22912291
}
22922292

0 commit comments

Comments
 (0)
0