Fixed problems with colons in tags
This commit is contained in:
parent
66535f6142
commit
7fc0cd7631
2 changed files with 6 additions and 3 deletions
|
@ -136,7 +136,8 @@ abstract class AbstractSearchParser
|
|||
$tokenText = substr($tokenText, 1);
|
||||
}
|
||||
|
||||
if (strpos($tokenText, ':') !== false)
|
||||
$colonPosition = strpos($tokenText, ':');
|
||||
if ($colonPosition !== false and $colonPosition > 0)
|
||||
{
|
||||
$searchToken = new \Szurubooru\SearchServices\Tokens\NamedSearchToken();
|
||||
list ($tokenKey, $tokenValue) = explode(':', $tokenText, 2);
|
||||
|
|
|
@ -93,9 +93,11 @@ class Validator
|
|||
foreach ($tags as $tag)
|
||||
{
|
||||
if (empty($tag))
|
||||
{
|
||||
throw new \DomainException('Tags cannot be empty.');
|
||||
}
|
||||
|
||||
//: causes problems with complex search (e.g. id:5).
|
||||
if (strpos($tag, ':') > 0)
|
||||
throw new \DomainException('Colon in tag may appear only at the beginning.');
|
||||
|
||||
$this->validateMaxLength($tag, 64, 'Tag');
|
||||
|
||||
|
|
Loading…
Reference in a new issue