diff mercurial/hgweb/webcommands.py @ 17289:f2d6b4f8e78c stable

hgweb: avoid traceback when file or node parameters are missing Previously, browsing to http://serv/diff would generate an internal server error due to the file and node parameters being missing. The same error also occurred for filelog, comparison and annotate.
author Ross Lagerwall <rosslagerwall@gmail.com>
date Mon, 30 Jul 2012 11:02:10 +0200
parents c0068b058fcd
children 5c64ce6168da
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Mon Jul 30 08:18:25 2012 +0200
+++ b/mercurial/hgweb/webcommands.py	Mon Jul 30 11:02:10 2012 +0200
@@ -586,6 +586,8 @@
 
 def comparison(web, req, tmpl):
     ctx = webutil.changectx(web.repo, req)
+    if 'file' not in req.form:
+        raise ErrorResponse(HTTP_NOT_FOUND, 'file not given')
     path = webutil.cleanpath(web.repo, req.form['file'][0])
     rename = path in ctx and webutil.renamelink(ctx[path]) or []