Browse Source

More hashtag checks

merge-requests/17/head
Bob Mottram 3 months ago
parent
commit
00af89ff3e
3 changed files with 6 additions and 3 deletions
  1. 1
    1
      categories.py
  2. 1
    1
      content.py
  3. 4
    1
      webapp_hashtagswarm.py

+ 1
- 1
categories.py View File

@@ -114,7 +114,7 @@ def _validHashtagCategory(category: str) -> bool:
114 114
     if not category:
115 115
         return False
116 116
 
117
-    invalidChars = (',', ' ', '<', ';', '\\', '"', '&')
117
+    invalidChars = (',', ' ', '<', ';', '\\', '"', '&', '#')
118 118
     for ch in invalidChars:
119 119
         if ch in category:
120 120
             return False

+ 1
- 1
content.py View File

@@ -382,7 +382,7 @@ def validHashTag(hashtag: str) -> bool:
382 382
                      'abcdefghijklmnopqrstuvwxyz' +
383 383
                      'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
384 384
     if set(hashtag).issubset(validChars):
385
-        if '&' not in hashtag:
385
+        if '&' not in hashtag and '#' not in hashtag:
386 386
             return True
387 387
     return False
388 388
 

+ 4
- 1
webapp_hashtagswarm.py View File

@@ -154,7 +154,10 @@ def htmlHashTagSwarm(baseDir: str, actor: str, translate: {}) -> str:
154 154
             if len(hashTagName) > maxTagLength:
155 155
                 # NoIncrediblyLongAndBoringHashtagsShownHere
156 156
                 continue
157
-            if '&' in hashTagName or '"' in hashTagName or "'" in hashTagName:
157
+            if '#' in hashTagName or \
158
+               '&' in hashTagName or \
159
+               '"' in hashTagName or \
160
+               "'" in hashTagName:
158 161
                 continue
159 162
             if '#' + hashTagName + '\n' in blockedStr:
160 163
                 continue

Loading…
Cancel
Save