From 419b5746c7137621beb0aaab179b5f2df48ec96c Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 5 Feb 2020 17:39:41 +0000 Subject: [PATCH] Check that strings are valid --- blocking.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/blocking.py b/blocking.py index 0cc37a28..ed923118 100644 --- a/blocking.py +++ b/blocking.py @@ -134,9 +134,10 @@ def isBlocked(baseDir: str,nickname: str,domain: str, \ if os.path.isfile(globalBlockingFilename): if '*@'+blockDomain in open(globalBlockingFilename).read(): return True - blockHandle=blockNickname+'@'+blockDomain - if blockHandle in open(globalBlockingFilename).read(): - return True + if blockNickname and blockDomain: + blockHandle=blockNickname+'@'+blockDomain + if blockHandle in open(globalBlockingFilename).read(): + return True allowFilename= \ baseDir+'/accounts/'+nickname+'@'+domain+'/allowedinstances.txt' if os.path.isfile(allowFilename): @@ -147,9 +148,10 @@ def isBlocked(baseDir: str,nickname: str,domain: str, \ if os.path.isfile(blockingFilename): if '*@'+blockDomain in open(blockingFilename).read(): return True - blockHandle=blockNickname+'@'+blockDomain - if blockHandle in open(blockingFilename).read(): - return True + if blockNickname and blockDomain: + blockHandle=blockNickname+'@'+blockDomain + if blockHandle in open(blockingFilename).read(): + return True return False def sendBlockViaServer(baseDir: str,session, \