hgweb: move call to protocol handler outside of try..except
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 31 Jan 2018 16:43:46 -0800
changeset 35985 e69e65b2b4a9
parent 35984 cdc93fe1da77
child 35986 98a00aa0288d
hgweb: move call to protocol handler outside of try..except The protocol handler doesn't raise ErrorResponse. So it doesn't need to be in this `try..except ErrorResponse` block. Differential Revision: https://phab.mercurial-scm.org/D2020
mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Wed Jan 31 16:21:43 2018 -0800
+++ b/mercurial/hgweb/hgweb_mod.py	Wed Jan 31 16:43:46 2018 -0800
@@ -368,7 +368,6 @@
                     raise ErrorResponse(HTTP_NOT_FOUND)
                 if cmd in perms:
                     self.check_perm(rctx, req, perms[cmd])
-                return protohandler['dispatch']()
             except ErrorResponse as inst:
                 # A client that sends unbundle without 100-continue will
                 # break if we respond early.
@@ -383,6 +382,8 @@
                             body='0\n%s\n' % inst)
                 return ''
 
+            return protohandler['dispatch']()
+
         # translate user-visible url structure to internal structure
 
         args = query.split('/', 2)