File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -283,14 +283,14 @@ function ParseLinks([string]$baseUri, [string]$htmlContent)
283283 $hrefRegex = " <a[^>]+href\s*=\s*["" ']?(?<href>[^"" ']*)["" ']?"
284284 $regexOptions = [System.Text.RegularExpressions.RegexOptions ]" Singleline, IgnoreCase" ;
285285
286- $hrefs = [RegEx ]::Matches($htmlContent , $hrefRegex , $regexOptions );
286+ $matches = [RegEx ]::Matches($htmlContent , $hrefRegex , $regexOptions );
287287
288- # $hrefs | Foreach-Object { Write-Host $_ }
288+ Write-Verbose " Found $ ( $matches .Count ) raw href's in page $baseUri " ;
289289
290- Write-Verbose " Found $ ( $hrefs .Count ) raw href's in page $baseUri " ;
291- [ string []] $links = $hrefs | ForEach-Object { ResolveUri $baseUri $ _.Groups [" href" ].Value }
290+ # Html encoded urls in anchor hrefs need to be decoded
291+ $urls = $matches | ForEach-Object { [ System.Web.HttpUtility ]::HtmlDecode( $ _.Groups [" href" ].Value) }
292292
293- # $links | Foreach -Object { Write-Host $_ }
293+ [ string []] $links = $urls | ForEach -Object { ResolveUri $baseUri $_ }
294294
295295 if ($null -eq $links ) {
296296 $links = @ ()
You can’t perform that action at this time.
0 commit comments