diff --git a/eng/common/scripts/Verify-Links.ps1 b/eng/common/scripts/Verify-Links.ps1 index 4a25d6bdca..ff905b5d3d 100644 --- a/eng/common/scripts/Verify-Links.ps1 +++ b/eng/common/scripts/Verify-Links.ps1 @@ -263,14 +263,14 @@ function ParseLinks([string]$baseUri, [string]$htmlContent) $hrefRegex = "]+href\s*=\s*[""']?(?[^""']*)[""']?" $regexOptions = [System.Text.RegularExpressions.RegexOptions]"Singleline, IgnoreCase"; - $hrefs = [RegEx]::Matches($htmlContent, $hrefRegex, $regexOptions); + $matches = [RegEx]::Matches($htmlContent, $hrefRegex, $regexOptions); - #$hrefs | Foreach-Object { Write-Host $_ } + Write-Verbose "Found $($matches.Count) raw href's in page $baseUri"; - Write-Verbose "Found $($hrefs.Count) raw href's in page $baseUri"; - [string[]] $links = $hrefs | ForEach-Object { ResolveUri $baseUri $_.Groups["href"].Value } + # Html encoded urls in anchor hrefs need to be decoded + $urls = $matches | ForEach-Object { [System.Web.HttpUtility]::HtmlDecode($_.Groups["href"].Value) } - #$links | Foreach-Object { Write-Host $_ } + [string[]] $links = $urls | ForEach-Object { ResolveUri $baseUri $_ } if ($null -eq $links) { $links = @()