File tree 1 file changed +5
-5
lines changed
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)
283
283
$hrefRegex = " <a[^>]+href\s*=\s*["" ']?(?<href>[^"" ']*)["" ']?"
284
284
$regexOptions = [System.Text.RegularExpressions.RegexOptions ]" Singleline, IgnoreCase" ;
285
285
286
- $hrefs = [RegEx ]::Matches($htmlContent , $hrefRegex , $regexOptions );
286
+ $matches = [RegEx ]::Matches($htmlContent , $hrefRegex , $regexOptions );
287
287
288
- # $hrefs | Foreach-Object { Write-Host $_ }
288
+ Write-Verbose " Found $ ( $matches .Count ) raw href's in page $baseUri " ;
289
289
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) }
292
292
293
- # $links | Foreach -Object { Write-Host $_ }
293
+ [ string []] $links = $urls | ForEach -Object { ResolveUri $baseUri $_ }
294
294
295
295
if ($null -eq $links ) {
296
296
$links = @ ()
You can’t perform that action at this time.
0 commit comments