Sanitize error message

This commit is contained in:
shortcutme 2018-11-21 19:28:30 +01:00
parent 3fd44a1813
commit 5ff22467a6
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -1,5 +1,6 @@
import sys
import os
import cgi
from Config import config
@ -30,7 +31,7 @@ def formatException(err=None, format="text"):
file = os.path.split(path)[1]
tb.append("%s line %s" % (file, line))
if format == "html":
return "%s: %s<br><small>%s</small>" % (exc_type.__name__, err, " > ".join(tb))
return "%s: %s<br><small>%s</small>" % (exc_type.__name__, cgi.escape(str(err)), " > ".join(tb))
else:
return "%s: %s in %s" % (exc_type.__name__, err, " > ".join(tb))