mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 15:23:12 +08:00
Added validateUrl optional flag for create/edit short URLs
This commit is contained in:
@@ -27,10 +27,11 @@ class UrlValidator implements UrlValidatorInterface, RequestMethodInterface
|
||||
/**
|
||||
* @throws InvalidUrlException
|
||||
*/
|
||||
public function validateUrl(string $url): void
|
||||
public function validateUrl(string $url, ?bool $doValidate): void
|
||||
{
|
||||
// If the URL validation is not enabled, skip check
|
||||
if (! $this->options->isUrlValidationEnabled()) {
|
||||
// If the URL validation is not enabled or it was explicitly set to not validate, skip check
|
||||
$doValidate = $doValidate ?? $this->options->isUrlValidationEnabled();
|
||||
if (! $doValidate) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,5 +11,5 @@ interface UrlValidatorInterface
|
||||
/**
|
||||
* @throws InvalidUrlException
|
||||
*/
|
||||
public function validateUrl(string $url): void;
|
||||
public function validateUrl(string $url, ?bool $doValidate): void;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user