Check the domain looks like a domain when extracting mentions

master
Bob Mottram 2019-08-19 11:13:09 +01:00
parent 470f32382a
commit 072481cc2b
1 changed files with 3 additions and 1 deletions

View File

@ -130,8 +130,10 @@ def addMention(wordStr: str,httpPrefix: str,following: str,replaceMentions: {},r
return True return True
# @nick@domain # @nick@domain
if '@' in possibleHandle: if '@' in possibleHandle:
possibleNickname=possibleHandle.split('@')[0]
replaceDomain=possibleHandle.split('@')[1] replaceDomain=possibleHandle.split('@')[1]
if not (replaceDomain=='localhost' or '.' in replaceDomain):
return False
possibleNickname=possibleHandle.split('@')[0]
recipientActor=httpPrefix+"://"+replaceDomain+"/users/"+possibleNickname recipientActor=httpPrefix+"://"+replaceDomain+"/users/"+possibleNickname
if recipientActor not in recipients: if recipientActor not in recipients:
recipients.append(recipientActor) recipients.append(recipientActor)