Validate hashtag name

main
Bob Mottram 2021-09-15 20:48:01 +01:00
parent e8c1091ea8
commit d3fc9ee45e
1 changed files with 3 additions and 0 deletions

View File

@ -97,6 +97,7 @@ from announce import isSelfAnnounce
from announce import createAnnounce from announce import createAnnounce
from notifyOnPost import notifyWhenPersonPosts from notifyOnPost import notifyWhenPersonPosts
from conversation import updateConversation from conversation import updateConversation
from content import validHashTag
def storeHashTags(baseDir: str, nickname: str, postJsonObject: {}) -> None: def storeHashTags(baseDir: str, nickname: str, postJsonObject: {}) -> None:
@ -132,6 +133,8 @@ def storeHashTags(baseDir: str, nickname: str, postJsonObject: {}) -> None:
if not tag.get('name'): if not tag.get('name'):
continue continue
tagName = tag['name'].replace('#', '').strip() tagName = tag['name'].replace('#', '').strip()
if not validHashTag(tagName):
continue
tagsFilename = tagsDir + '/' + tagName + '.txt' tagsFilename = tagsDir + '/' + tagName + '.txt'
postUrl = removeIdEnding(postJsonObject['id']) postUrl = removeIdEnding(postJsonObject['id'])
postUrl = postUrl.replace('/', '#') postUrl = postUrl.replace('/', '#')