diff --git a/server/szurubooru/search/search_executor.py b/server/szurubooru/search/search_executor.py index fc5d9c0a..fad2bed7 100644 --- a/server/szurubooru/search/search_executor.py +++ b/server/szurubooru/search/search_executor.py @@ -58,7 +58,7 @@ class SearchExecutor(object): token = token[1:] negated = not negated - if ':' in token: + if ':' in token and token[0] != ':': key, value = token.split(':', 2) query = self._handle_key_value(query, key, value, negated) else: diff --git a/server/szurubooru/tests/search/test_tag_search_config.py b/server/szurubooru/tests/search/test_tag_search_config.py index 3b234337..e1d17866 100644 --- a/server/szurubooru/tests/search/test_tag_search_config.py +++ b/server/szurubooru/tests/search/test_tag_search_config.py @@ -29,6 +29,10 @@ def test_filter_anonymous(verify_unpaged, tag_factory, input, expected_tag_names db.session.add(tag_factory(names=['t2'])) verify_unpaged(input, expected_tag_names) +def test_filter_anonymous_starting_with_colon(verify_unpaged, tag_factory): + db.session.add(tag_factory(names=[':t'])) + verify_unpaged(':t', [':t']) + @pytest.mark.parametrize('input,expected_tag_names', [ ('name:tag1', ['tag1']), ('name:tag2', ['tag2']),