diff mercurial/hgweb/hgweb_mod.py @ 50896:b2b8c25f9462

hgwebmod: use sysstr to check for attribute presence We do not need bytes here.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 30 Aug 2023 13:28:09 +0200
parents 3b642b384b14
children d718eddf01d9
line wrap: on
line diff
--- 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)