Only display error details in debug mode

This commit is contained in:
shortcutme 2019-04-11 02:28:26 +02:00
parent 85fd08774f
commit 7a217a3741
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -810,7 +810,7 @@ class UiRequest(object):
import sys import sys
import gevent import gevent
if details: if details and config.debug:
details = {key: val for key, val in self.env.items() if hasattr(val, "endswith") and "COOKIE" not in key} details = {key: val for key, val in self.env.items() if hasattr(val, "endswith") and "COOKIE" not in key}
details["version_zeronet"] = "%s r%s" % (config.version, config.rev) details["version_zeronet"] = "%s r%s" % (config.version, config.rev)
details["version_python"] = sys.version details["version_python"] = sys.version
@ -825,7 +825,7 @@ class UiRequest(object):
</style> </style>
<h1>%s</h1> <h1>%s</h1>
<h2>%s</h3> <h2>%s</h3>
<h3>Please <a href="https://github.com/HelloZeroNet/ZeroNet/issues" target="_blank">report it</a> if you think this an error.</h3> <h3>Please <a href="https://github.com/HelloZeroNet/ZeroNet/issues" target="_top">report it</a> if you think this an error.</h3>
<h4>Details:</h4> <h4>Details:</h4>
<pre>%s</pre> <pre>%s</pre>
""" % (title, cgi.escape(message), cgi.escape(json.dumps(details, indent=4, sort_keys=True))) """ % (title, cgi.escape(message), cgi.escape(json.dumps(details, indent=4, sort_keys=True)))