Patchwork D2661: hgweb: fix up trailing slash detection on Python 3

login
register
mail settings
Submitter phabricator
Date March 4, 2018, 7:17 p.m.
Message ID <10c9fa559a19dcfecc01c2ea42601d35@localhost.localdomain>
Download mbox | patch
Permalink /patch/28966/
State Not Applicable
Headers show

Comments

phabricator - March 4, 2018, 7:17 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG250f3168d907: hgweb: fix up trailing slash detection on Python 3 (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2661?vs=6580&id=6589

REVISION DETAIL
  https://phab.mercurial-scm.org/D2661

AFFECTED FILES
  contrib/python3-whitelist
  mercurial/hgweb/webcommands.py
  mercurial/hgweb/webutil.py

CHANGE DETAILS




To: durin42, pulkit, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -38,9 +38,9 @@ 
 )
 
 def up(p):
-    if p[0] != "/":
+    if p[0:1] != "/":
         p = "/" + p
-    if p[-1] == "/":
+    if p[-1:] == "/":
         p = p[:-1]
     up = os.path.dirname(p)
     if up == "/":
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -495,7 +495,7 @@ 
     dirs = {}
     parity = paritygen(web.stripecount)
 
-    if path and path[-1] != "/":
+    if path and path[-1:] != "/":
         path += "/"
     l = len(path)
     abspath = "/" + path
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -130,6 +130,8 @@ 
 test-hghave.t
 test-hgignore.t
 test-hgk.t
+test-hgweb-bundle.t
+test-hgweb-descend-empties.t
 test-hgweb-removed.t
 test-histedit-arguments.t
 test-histedit-base.t