[PATCH v3] py3: properly reject non-encoded strings given to hgweb

Ludovic Chabant ludovic at chabant.com
Sun Apr 28 00:22:53 EDT 2019


# HG changeset patch
# User Ludovic Chabant <ludovic at chabant.com>
# Date 1555683992 0
#      Fri Apr 19 14:26:32 2019 +0000
# Branch stable
# Node ID 6805ebb0f1f6a7f34a74732ee6f6ec14e8824e42
# Parent  3611368a1af3037427eb59635c7dad8dab67c606
py3: properly reject non-encoded strings given to hgweb

diff --git a/mercurial/hgweb/__init__.py b/mercurial/hgweb/__init__.py
--- a/mercurial/hgweb/__init__.py
+++ b/mercurial/hgweb/__init__.py
@@ -13,6 +13,7 @@
 from ..i18n import _
 
 from .. import (
+    encoding,
     error,
     pycompat,
 )
@@ -38,6 +39,9 @@
     - list of virtual:real tuples (multi-repo view)
     '''
 
+    if isinstance(config, pycompat.unicode):
+        raise error.ProgrammingError(
+            'Mercurial only supports encoded strings: %r' % config)
     if ((isinstance(config, bytes) and not os.path.isdir(config)) or
         isinstance(config, dict) or isinstance(config, list)):
         # create a multi-dir interface


More information about the Mercurial-devel mailing list