Check that ports are digits

main
Bob Mottram 2020-03-01 10:18:08 +00:00
parent c84fae54f1
commit c6b002652b
4 changed files with 13 additions and 4 deletions

View File

@ -109,7 +109,9 @@ def manualApproveFollowRequest(session,baseDir: str, \
handleOfFollowRequester=handleOfFollowRequester.replace('\n','')
port2=port
if ':' in handleOfFollowRequester:
port2=int(handleOfFollowRequester.split(':')[1])
port2Str=handleOfFollowRequester.split(':')[1]
if port2Str.isdigit():
port2=int(port2Str)
requestsDir=accountDir+'/requests'
followActivityfilename=requestsDir+'/'+handleOfFollowRequester+'.follow'
if os.path.isfile(followActivityfilename):

View File

@ -83,7 +83,10 @@ def outboxSkills(baseDir: str,nickname: str,messageJson: {},debug: bool) -> bool
return False
domain,port=getDomainFromActor(messageJson['actor'])
skill=messageJson['object'].replace('"','').split(';')[0].strip()
skillLevelPercent=int(messageJson['object'].replace('"','').split(';')[1].strip())
skillLevelPercentStr=messageJson['object'].replace('"','').split(';')[1].strip()
skillLevelPercent=50
if skillLevelPercentStr.isdigit():
skillLevelPercent=int(skillLevelPercentStr)
return setSkillLevel(baseDir,nickname,domain, \
skill,skillLevelPercent)

View File

@ -48,7 +48,9 @@ def webfingerHandle(session,handle: str,httpPrefix: str,cachedWebfingers: {}, \
return None
wfDomain=domain
if ':' in wfDomain:
#wfPort=int(wfDomain.split(':')[1])
#wfPortStr=wfDomain.split(':')[1]
#if wfPortStr.isdigit():
# wfPort=int(wfPortStr)
#if wfPort==80 or wfPort==443:
wfDomain=wfDomain.split(':')[0]
wf=getWebfingerFromCache(nickname+'@'+wfDomain,cachedWebfingers)

View File

@ -4923,7 +4923,9 @@ def htmlProfileAfterSearch(recentPostsCache: {},maxRecentPosts: int, \
searchDomain=profileHandle.split('@')[1]
searchPort=None
if ':' in searchDomain:
searchPort=int(searchDomain.split(':')[1])
searchPortStr=searchDomain.split(':')[1]
if searchPortStr.isdigit():
searchPort=int(searchPortStr)
searchDomain=searchDomain.split(':')[0]
if not searchNickname:
if debug: