From 2070f37de4d916a7231de69ae5cd6fbbbc85135d Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Fri, 2 Oct 2015 07:50:34 -0400 Subject: [PATCH] flip escape order We were double escaping commas and dashes because we escaped them first, then escaped the % with urlencode. If we do this in the other order we get shorter and less fragile urls. Change-Id: I0f5f2d486c66a62469eae02d884fb31de78df803 --- gerrit_dash_creator/cmd/creator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gerrit_dash_creator/cmd/creator.py b/gerrit_dash_creator/cmd/creator.py index 752662d..48b9676 100755 --- a/gerrit_dash_creator/cmd/creator.py +++ b/gerrit_dash_creator/cmd/creator.py @@ -46,8 +46,8 @@ def generate_dashboard_url(dashboard): baseurl = 'https://review.openstack.org/#/dashboard/?' url = baseurl - url += urllib.urlencode({'title': escape(title), - 'foreach': escape(foreach)}) + url += escape(urllib.urlencode({'title': title, + 'foreach': foreach})) for section in dashboard.sections(): if not section.startswith('section'): continue @@ -58,7 +58,7 @@ def generate_dashboard_url(dashboard): raise ValueError("option 'query' in '%s' not set" % section) title = section[9:-1] - encoded = urllib.urlencode({escape(title): escape(query)}) + encoded = escape(urllib.urlencode({title: query})) url += "&%s" % encoded return url