Patchwork D2788: hgweb: remove one-off routing for file?style=raw

login
register
mail settings
Submitter phabricator
Date March 11, 2018, 5:24 a.m.
Message ID <differential-rev-PHID-DREV-vf327oeer2g73npkw5xq-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/29280/
State Superseded
Headers show

Comments

phabricator - March 11, 2018, 5:24 a.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Now that both functions are using the same API, we can unify how
  the command is called and perform command-specific behavior in the
  command itself instead of in the high-level router.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/hgweb/hgweb_mod.py
  mercurial/hgweb/webcommands.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -186,6 +186,9 @@ 
     If ``path`` is not defined, information about the root directory will
     be rendered.
     """
+    if web.req.qsparams.get('style') == 'raw':
+        return rawfile(web, req, tmpl)
+
     path = webutil.cleanpath(web.repo, req.req.qsparams.get('file', ''))
     if not path:
         return manifest(web, req, tmpl)
diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -399,12 +399,6 @@ 
             if cmd not in webcommands.__all__:
                 msg = 'no such method: %s' % cmd
                 raise ErrorResponse(HTTP_BAD_REQUEST, msg)
-            elif cmd == 'file' and req.qsparams.get('style') == 'raw':
-                res.status = '200 Script output follows'
-                res.headers['Content-Type'] = ctype
-                content = webcommands.rawfile(rctx, wsgireq, tmpl)
-                assert content is res
-                return res.sendresponse()
             else:
                 # Set some globals appropriate for web handlers. Commands can
                 # override easily enough.