gerrit_util: work with all paths.
BUG=chromium:664664
TEST=local
- Didn't work locally, now it does.
Change-Id: I5d470feda420342b0fb00a56e42a2b7d00257920
Reviewed-on: https://chromium-review.googlesource.com/411284
Reviewed-by: Aaron Gable <agable@chromium.org>
diff --git a/gerrit_util.py b/gerrit_util.py
index a433e83..0c73785 100755
--- a/gerrit_util.py
+++ b/gerrit_util.py
@@ -266,10 +266,11 @@
else:
LOGGER.debug('No authorization found for %s.' % bare_host)
- if 'Authorization' in headers and not path.startswith('/a/'):
- url = '/a%s' % path
- else:
- url = '%s' % path
+ url = path
+ if not url.startswith('/'):
+ url = '/' + url
+ if 'Authorization' in headers and not url.startswith('/a/'):
+ url = '/a%s' % url
if body:
body = json.JSONEncoder().encode(body)