# HG changeset patch
# User Brendan Cully <brendan@kublai.com>
# Date 2006-11-01 02:10:23
# Node ID f8589028a7fa6f807866a76515b1146be9187e7a
# Parent  9d815b074dcb148fdde1c22e5db123c27e3d878b

hgweb: split URLs containing spaces or other escaped characters correctly

diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -708,7 +708,7 @@ class hgweb(object):
                     return '%s%s%s' % (url.startswith('/') and '/' or '',
                                        inner, tl)
 
-                root = normurl(req.env.get('REQUEST_URI', '').split('?', 1)[0])
+                root = normurl(urllib.unquote(req.env.get('REQUEST_URI', '').split('?', 1)[0]))
                 pi = normurl(req.env.get('PATH_INFO', ''))
                 if pi:
                     # strip leading /