hgwebmod: use sysstr to check for attribute presence
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 30 Aug 2023 13:28:09 +0200
changeset 50896 b2b8c25f9462
parent 50895 a834ec41f17c
child 50897 6ca865080479
hgwebmod: use sysstr to check for attribute presence We do not need bytes here.
mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Wed Aug 30 13:07:00 2023 +0200
+++ b/mercurial/hgweb/hgweb_mod.py	Wed Aug 30 13:28:09 2023 +0200
@@ -403,7 +403,7 @@
                 cmd = cmd[style + 1 :]
 
             # avoid accepting e.g. style parameter as command
-            if util.safehasattr(webcommands, cmd):
+            if util.safehasattr(webcommands, pycompat.sysstr(cmd)):
                 req.qsparams[b'cmd'] = cmd
 
             if cmd == b'static':
@@ -474,7 +474,7 @@
                 # override easily enough.
                 res.status = b'200 Script output follows'
                 res.headers[b'Content-Type'] = ctype
-                return getattr(webcommands, cmd)(rctx)
+                return getattr(webcommands, pycompat.sysstr(cmd))(rctx)
 
         except (error.LookupError, error.RepoLookupError) as err:
             msg = pycompat.bytestr(err)