mirror of https://gitlab.com/bashrc2/epicyon
More hashtag validation
parent
ca9c6080d8
commit
ee673b92ce
|
|
@ -13,6 +13,7 @@ from timeFunctions import date_utcnow
|
||||||
from timeFunctions import date_epoch
|
from timeFunctions import date_epoch
|
||||||
from utils import data_dir
|
from utils import data_dir
|
||||||
from utils import replace_strings
|
from utils import replace_strings
|
||||||
|
from utils import get_invalid_characters
|
||||||
|
|
||||||
MAX_TAG_LENGTH = 42
|
MAX_TAG_LENGTH = 42
|
||||||
|
|
||||||
|
|
@ -226,6 +227,10 @@ def _valid_hashtag_category(category: str) -> bool:
|
||||||
if not category:
|
if not category:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
for char in get_invalid_characters():
|
||||||
|
if char in category:
|
||||||
|
return False
|
||||||
|
|
||||||
for char in INVALID_HASHTAG_CHARS:
|
for char in INVALID_HASHTAG_CHARS:
|
||||||
if char in category:
|
if char in category:
|
||||||
return False
|
return False
|
||||||
|
|
@ -233,7 +238,7 @@ def _valid_hashtag_category(category: str) -> bool:
|
||||||
# too long or too short
|
# too long or too short
|
||||||
if len(category) > 40:
|
if len(category) > 40:
|
||||||
return False
|
return False
|
||||||
elif len(category) == 0:
|
if len(category) == 0:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
|
||||||
6
utils.py
6
utils.py
|
|
@ -1017,6 +1017,12 @@ def evil_nickname(sending_actor_nickname: str) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def get_invalid_characters() -> []:
|
||||||
|
"""Returns the list of invalid characters
|
||||||
|
"""
|
||||||
|
return INVALID_CHARACTERS
|
||||||
|
|
||||||
|
|
||||||
def contains_invalid_chars(json_str: str) -> bool:
|
def contains_invalid_chars(json_str: str) -> bool:
|
||||||
"""Does the given json string contain invalid characters?
|
"""Does the given json string contain invalid characters?
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue