Skip to content
Merged
Changes from all commits
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
12 changes: 6 additions & 6 deletions eng/common/scripts/Verify-Links.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

.PARAMETER outputCacheFile
Path to a file that the script will output all the validated links after running all checks.

.PARAMETER requestTimeoutSec
The number of seconds before we timeout when sending an individual web request. Default is 15 seconds.

Expand Down Expand Up @@ -332,7 +332,7 @@ function GetLinks([System.Uri]$pageUri)
{
if ($pageUri.Scheme.StartsWith("http")) {
try {
$response = Invoke-WebRequest -Uri $pageUri -UserAgent $userAgent -TimeoutSec $requestTimeoutSec
$response = Invoke-WebRequest -Uri $pageUri -UserAgent $userAgent -TimeoutSec $requestTimeoutSec -MaximumRetryCount 3
$content = $response.Content

if ($pageUri.ToString().EndsWith(".md")) {
Expand All @@ -341,7 +341,7 @@ function GetLinks([System.Uri]$pageUri)
}
catch {
$statusCode = $_.Exception.Response.StatusCode.value__
Write-Error "Invalid page [$statusCode] $pageUri"
LogError "Invalid page [$statusCode] $pageUri"
}
}
elseif ($pageUri.IsFile -and (Test-Path $pageUri.LocalPath)) {
Expand All @@ -363,7 +363,7 @@ function GetLinks([System.Uri]$pageUri)
}
}
else {
Write-Error "Don't know how to process uri $pageUri"
LogError "Don't know how to process uri $pageUri"
}

$links = ParseLinks $pageUri $content
Expand Down Expand Up @@ -396,12 +396,12 @@ if ($inputCacheFile)
$cacheContent = ""
if ($inputCacheFile.StartsWith("http")) {
try {
$response = Invoke-WebRequest -Uri $inputCacheFile -TimeoutSec $requestTimeoutSec
$response = Invoke-WebRequest -Uri $inputCacheFile -TimeoutSec $requestTimeoutSec -MaximumRetryCount 3
$cacheContent = $response.Content
}
catch {
$statusCode = $_.Exception.Response.StatusCode.value__
Write-Error "Failed to read cache file from page [$statusCode] $inputCacheFile"
LogError "Failed to read cache file from page [$statusCode] $inputCacheFile"
}
}
elseif (Test-Path $inputCacheFile) {
Expand Down