launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26524
[Merge] ~cjwatson/launchpad:py3-loggerhead-path-encoding into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-loggerhead-path-encoding into launchpad:master.
Commit message:
Fix path encoding in Loggerhead app
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/399033
The trailing part of the path was being encoded too early, and on Python 3 it needs to be left as a native string.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-loggerhead-path-encoding into launchpad:master.
diff --git a/lib/launchpad_loggerhead/app.py b/lib/launchpad_loggerhead/app.py
index d6a653b..cf7e1e7 100644
--- a/lib/launchpad_loggerhead/app.py
+++ b/lib/launchpad_loggerhead/app.py
@@ -39,6 +39,7 @@ from paste.request import (
parse_querystring,
path_info_pop,
)
+import six
from six.moves import xmlrpc_client
from six.moves.urllib.parse import (
urlencode,
@@ -248,7 +249,7 @@ class RootApp:
raise
if transport_type != BRANCH_TRANSPORT:
raise HTTPNotFound()
- trail = urlutils.unescape(trail).encode('utf-8')
+ trail = urlutils.unescape(trail)
trail += trailingSlashCount * '/'
amount_consumed = len(path) - len(trail)
consumed = path[:amount_consumed]
@@ -256,7 +257,7 @@ class RootApp:
self.log.info('Using branch: %s', branch_name)
if trail and not trail.startswith('/'):
trail = '/' + trail
- environ['PATH_INFO'] = trail
+ environ['PATH_INFO'] = six.ensure_str(trail)
environ['SCRIPT_NAME'] += consumed.rstrip('/')
branch_url = lp_server.get_url() + branch_name
branch_link = urljoin(