Ensure request is not performed if both title resolution and URL validation are disabled

This commit is contained in:
Alejandro Celaya
2021-02-05 18:22:54 +01:00
parent 608742c2e2
commit d386e1405c
2 changed files with 8 additions and 4 deletions

View File

@@ -47,9 +47,12 @@ class UrlValidator implements UrlValidatorInterface, RequestMethodInterface
public function validateUrlWithTitle(string $url, ?bool $doValidate): ?string
{
$doValidate = $doValidate ?? $this->options->isUrlValidationEnabled();
$response = $this->validateUrlAndGetResponse($url, $doValidate);
if (! $doValidate && ! $this->options->autoResolveTitles()) {
return null;
}
if ($response === null || ! $this->options->autoResolveTitles()) {
$response = $this->validateUrlAndGetResponse($url, $doValidate);
if ($response === null) {
return null;
}