Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if self.request.path.startswith('/viz/file/'):
if self.settings['single_user_mode']:
# Allow opening arbitrary files by full filesystem path
# WARNING!!! Obviously this must be disabled by default
# TODO: Some modicum of error handling here as well...
json_path = '/json/file/%s.json' % profile_name
if profile_name[0] != '/' and platform.system() != 'Windows':
profile_name = '/' + profile_name
filename = os.path.abspath(profile_name)
else:
# TODO: Raise a 404 error here
pass
else:
filename = upload.storage_name(profile_name)
json_path = '/json/%s.json' % filename
rows = stats_rows(filename)
self.render('viz.html', profile_name=profile_name, json_path=json_path,
stats_rows=rows)