mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-14 04:00:57 +03:00
Ensured empty values cannot be provided as the custom slug
This commit is contained in:
parent
f6a83a3062
commit
67e93a6874
1 changed files with 5 additions and 2 deletions
|
@ -40,8 +40,11 @@ class ShortUrlMetaInputFilter extends InputFilter
|
|||
$validUntil->getValidatorChain()->attach(new Validator\Date(['format' => DateTime::ATOM]));
|
||||
$this->add($validUntil);
|
||||
|
||||
$customSlug = $this->createInput(self::CUSTOM_SLUG, false);
|
||||
// FIXME The only way to enforce the NotEmpty validator to be evaluated when the value is provided but it's
|
||||
// empty, is by using the deprecated setContinueIfEmpty
|
||||
$customSlug = $this->createInput(self::CUSTOM_SLUG, false)->setContinueIfEmpty(true);
|
||||
$customSlug->getFilterChain()->attach(new Validation\SluggerFilter());
|
||||
$customSlug->getValidatorChain()->attach(new Validator\NotEmpty());
|
||||
$this->add($customSlug);
|
||||
|
||||
$this->add($this->createPositiveNumberInput(self::MAX_VISITS));
|
||||
|
@ -58,7 +61,7 @@ class ShortUrlMetaInputFilter extends InputFilter
|
|||
{
|
||||
$input = $this->createInput($name, false);
|
||||
$input->getValidatorChain()->attach(new Validator\Digits())
|
||||
->attach(new Validator\GreaterThan(['min' => $min, 'inclusive' => true]));
|
||||
->attach(new Validator\GreaterThan(['min' => $min, 'inclusive' => true]));
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue