mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Merge pull request #676 from acelaya-forks/feature/bar-slug
Feature/bar slug
This commit is contained in:
commit
c9f17d54ee
@ -27,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
|
|||||||
#### Fixed
|
#### Fixed
|
||||||
|
|
||||||
* [#665](https://github.com/shlinkio/shlink/issues/665) Fixed `base_url_redirect_to` simplified config option not being properly parsed.
|
* [#665](https://github.com/shlinkio/shlink/issues/665) Fixed `base_url_redirect_to` simplified config option not being properly parsed.
|
||||||
|
* [#663](https://github.com/shlinkio/shlink/issues/663) Fixed Shlink allowing short URLs to be created with an empty custom slug.
|
||||||
|
|
||||||
|
|
||||||
## 2.0.5 - 2020-02-09
|
## 2.0.5 - 2020-02-09
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
"predis/predis": "^1.1",
|
"predis/predis": "^1.1",
|
||||||
"pugx/shortid-php": "^0.5",
|
"pugx/shortid-php": "^0.5",
|
||||||
"ramsey/uuid": "^3.9",
|
"ramsey/uuid": "^3.9",
|
||||||
"shlinkio/shlink-common": "^2.7.0",
|
"shlinkio/shlink-common": "^2.8.0",
|
||||||
"shlinkio/shlink-event-dispatcher": "^1.3",
|
"shlinkio/shlink-event-dispatcher": "^1.3",
|
||||||
"shlinkio/shlink-installer": "^4.2.0",
|
"shlinkio/shlink-installer": "^4.2.0",
|
||||||
"shlinkio/shlink-ip-geolocation": "^1.3.1",
|
"shlinkio/shlink-ip-geolocation": "^1.3.1",
|
||||||
|
@ -40,8 +40,14 @@ class ShortUrlMetaInputFilter extends InputFilter
|
|||||||
$validUntil->getValidatorChain()->attach(new Validator\Date(['format' => DateTime::ATOM]));
|
$validUntil->getValidatorChain()->attach(new Validator\Date(['format' => DateTime::ATOM]));
|
||||||
$this->add($validUntil);
|
$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->getFilterChain()->attach(new Validation\SluggerFilter());
|
||||||
|
$customSlug->getValidatorChain()->attach(new Validator\NotEmpty([
|
||||||
|
Validator\NotEmpty::STRING,
|
||||||
|
Validator\NotEmpty::SPACE,
|
||||||
|
]));
|
||||||
$this->add($customSlug);
|
$this->add($customSlug);
|
||||||
|
|
||||||
$this->add($this->createPositiveNumberInput(self::MAX_VISITS));
|
$this->add($this->createPositiveNumberInput(self::MAX_VISITS));
|
||||||
@ -58,7 +64,7 @@ class ShortUrlMetaInputFilter extends InputFilter
|
|||||||
{
|
{
|
||||||
$input = $this->createInput($name, false);
|
$input = $this->createInput($name, false);
|
||||||
$input->getValidatorChain()->attach(new Validator\Digits())
|
$input->getValidatorChain()->attach(new Validator\Digits())
|
||||||
->attach(new Validator\GreaterThan(['min' => $min, 'inclusive' => true]));
|
->attach(new Validator\GreaterThan(['min' => $min, 'inclusive' => true]));
|
||||||
|
|
||||||
return $input;
|
return $input;
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,15 @@ class ShortUrlMetaTest extends TestCase
|
|||||||
yield [[
|
yield [[
|
||||||
ShortUrlMetaInputFilter::SHORT_CODE_LENGTH => 3,
|
ShortUrlMetaInputFilter::SHORT_CODE_LENGTH => 3,
|
||||||
]];
|
]];
|
||||||
|
yield [[
|
||||||
|
ShortUrlMetaInputFilter::CUSTOM_SLUG => '/',
|
||||||
|
]];
|
||||||
|
yield [[
|
||||||
|
ShortUrlMetaInputFilter::CUSTOM_SLUG => '',
|
||||||
|
]];
|
||||||
|
yield [[
|
||||||
|
ShortUrlMetaInputFilter::CUSTOM_SLUG => ' ',
|
||||||
|
]];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
|
Loading…
Reference in New Issue
Block a user