From 07b5060aa8f4f3cc87a985c15725c74b7b699307 Mon Sep 17 00:00:00 2001 From: Mike Date: Thu, 5 Feb 2009 16:01:48 -0800 Subject: [PATCH] no img tags in comments --- r2/r2/lib/filters.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/r2/r2/lib/filters.py b/r2/r2/lib/filters.py index 53e564bab..e69e12d6f 100644 --- a/r2/r2/lib/filters.py +++ b/r2/r2/lib/filters.py @@ -97,6 +97,7 @@ def edit_comment_filter(text = ''): #TODO is this fast? r_url = re.compile('(?', re.I | re.S) +img = re.compile('', re.I | re.S) href_re = re.compile('([^<]+)') a_re = re.compile('>([^<]+)') @@ -115,6 +116,8 @@ def safemarkdown(text): text = markdown(text) except RuntimeError: text = "

Comment Broken

" + #remove images + text = img.sub('', text) #wipe malicious javascript text = jscript_url.sub('', text) def href_handler(m):