Browse files

Disallow backslashes in stylesheets. Work-around for bug in cssutils …

…related to greedy parsing of them.
  • Loading branch information...
1 parent 4ba2eb7 commit 1d05efe34b951836717392d5f6900f3841fa2048 @ketralnis ketralnis committed Apr 26, 2009
Showing with 4 additions and 1 deletion.
  1. +4 −1 r2/r2/lib/cssfilter.py
View
5 r2/r2/lib/cssfilter.py
@@ -240,14 +240,17 @@ def validate_css(string):
return ('',ValidationReport())
report = ValidationReport(string)
-
+
# avoid a very expensive parse
max_size_kb = 100;
if len(string) > max_size_kb * 1024:
report.append(ValidationError((msgs['too_big']
% dict (max_size = max_size_kb))))
return (string, report)
+ if '\\' in string:
+ report.append(ValidationError(_("if you need backslashes, you're doing it wrong")))
+
try:
parsed = p.parseString(string)
except DOMException,e:

0 comments on commit 1d05efe

Please sign in to comment.