Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply sanitization after following redirects on the Powershell script.
  • Loading branch information
baronfel committed Dec 21, 2024
commit f5d33988de977a07a48b09354abc622eef2b1052
10 changes: 5 additions & 5 deletions src/dotnet-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,6 @@ function Get-AkaMSDownloadLink([string]$Channel, [string]$Quality, [bool]$Intern
return $null
}

$actualRedirectUrl = Sanitize-RedirectUrl $akaMsDownloadLink
if ($null -ne $actualRedirectUrl) {
$akaMsDownloadLink = $actualRedirectUrl
}

Say-Verbose "The redirect location retrieved: '$akaMsDownloadLink'."
# This may yet be a link to another redirection. Attempt to retrieve the page again.
$akaMsLink = $akaMsDownloadLink
Expand All @@ -1086,6 +1081,11 @@ function Get-AkaMSDownloadLink([string]$Channel, [string]$Quality, [bool]$Intern
}
elseif ((($Response.StatusCode -lt 300) -or ($Response.StatusCode -ge 400)) -and (-not [string]::IsNullOrEmpty($akaMsDownloadLink))) {
# Redirections have ended.
$actualRedirectUrl = Sanitize-RedirectUrl $akaMsDownloadLink
if ($null -ne $actualRedirectUrl) {
$akaMsDownloadLink = $actualRedirectUrl
}

return $akaMsDownloadLink
}

Expand Down