diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py
index 478026f14..225b38f04 100644
--- a/files/helpers/sanitize.py
+++ b/files/helpers/sanitize.py
@@ -13,115 +13,23 @@ import signal
import time
import requests
-allowed_tags = tags = ['b',
- 'blockquote',
- 'br',
- 'code',
- 'del',
- 'em',
- 'h1',
- 'h2',
- 'h3',
- 'h4',
- 'h5',
- 'h6',
- 'hr',
- 'i',
- 'li',
- 'ol',
- 'p',
- 'pre',
- 'strong',
- 'sub',
- 'sup',
- 'table',
- 'tbody',
- 'th',
- 'thead',
- 'td',
- 'tr',
- 'ul',
- 'marquee',
- 'a',
- 'img',
- 'span',
- 'ruby',
- 'rp',
- 'rt',
- ]
-
-no_images = ['b',
- 'blockquote',
- 'br',
- 'code',
- 'del',
- 'em',
- 'h1',
- 'h2',
- 'h3',
- 'h4',
- 'h5',
- 'h6',
- 'hr',
- 'i',
- 'li',
- 'ol',
- 'p',
- 'pre',
- 'strong',
- 'sub',
- 'sup',
- 'table',
- 'tbody',
- 'th',
- 'thead',
- 'td',
- 'tr',
- 'ul',
- 'marquee',
- 'a',
- 'span',
- 'ruby',
- 'rp',
- 'rt',
- ]
-
-def sanitize_marquee(tag, name, value):
- if name in allowed_attributes['*'] or name in ['direction', 'behavior', 'scrollamount']: return True
-
- if name in {'height', 'width'}:
- try: value = int(value.replace('px', ''))
- except: return False
- if 0 < value <= 250: return True
-
- return False
-
-allowed_attributes = {
- '*': ['href', 'style', 'src', 'title', 'loading'],
- 'marquee': sanitize_marquee}
-
-allowed_protocols = ['http', 'https']
-
-allowed_styles = ['color', 'background-color', 'font-weight', 'text-align']
-
-
-def handler(signum, frame):
- print("Forever is over!")
- raise Exception("end of time")
-
def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
+ def handler(signum, frame):
+ print("Timeout!")
+ raise Exception("Timeout")
+
signal.signal(signal.SIGALRM, handler)
signal.alarm(1)
-
+
sanitized = image_check_regex.sub(r'\1', sanitized)
sanitized = markdown(sanitized)
sanitized = strikethrough_regex.sub(r'\1', sanitized)
- sanitized = sanitized.replace('','').replace('','').replace("\ufeff", "").replace("𒐪","").replace("
+