From 60abb1a0a6ddd9d821e5e8013b6469de2e54d73a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 3 Dec 2020 19:51:47 +0000 Subject: [PATCH] Check for blocked hashtag with hash prefix --- blocking.py | 2 ++ newswire.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/blocking.py b/blocking.py index 395faf23..8cb23e5b 100644 --- a/blocking.py +++ b/blocking.py @@ -131,6 +131,8 @@ def isBlockedHashtag(baseDir: str, hashtag: str) -> bool: globalBlockingFilename = baseDir + '/accounts/blocking.txt' if os.path.isfile(globalBlockingFilename): hashtag = hashtag.strip('\n').strip('\r') + if not hashtag.startswith('#'): + hashtag = '#' + hashtag if hashtag + '\n' in open(globalBlockingFilename).read(): return True return False diff --git a/newswire.py b/newswire.py index 295579de..7ee8ef78 100644 --- a/newswire.py +++ b/newswire.py @@ -123,7 +123,7 @@ def addNewswireDictEntry(baseDir: str, domain: str, # check that no tags are blocked for tag in postTags: - if isBlockedHashtag(baseDir, tag.replace('#', '')): + if isBlockedHashtag(baseDir, tag): return newswire[dateStr] = [