From f7eaff082815069b0affdb8a6ac58d243195a735 Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 2 May 2018 12:52:58 +0200 Subject: [PATCH 1/2] ensure changed is defined avoids UnboundLocal error when no change has occurred --- jupyterhub/log.py | 1 + 1 file changed, 1 insertion(+) diff --git a/jupyterhub/log.py b/jupyterhub/log.py index 83c08445..99cb2a46 100644 --- a/jupyterhub/log.py +++ b/jupyterhub/log.py @@ -70,6 +70,7 @@ def _scrub_uri(uri): # use manual list + split rather than parsing # to minimally perturb original parts = parsed.query.split('&') + changed = False for i, s in enumerate(parts): if '=' in s: key, value = s.split('=', 1) From cd746d72d49545a1aad0070b22bec31a1945119f Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 2 May 2018 12:58:50 +0200 Subject: [PATCH 2/2] scrub redirect urls as well --- jupyterhub/log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyterhub/log.py b/jupyterhub/log.py index 99cb2a46..73ed8d21 100644 --- a/jupyterhub/log.py +++ b/jupyterhub/log.py @@ -154,6 +154,6 @@ def log_request(handler): # to get headers from tornado location = handler._headers.get('Location') if location: - ns['location'] = ' -> {}'.format(location) + ns['location'] = ' -> {}'.format(_scrub_uri(location)) log_method(msg.format(**ns)) prometheus_log_method(handler)