[PATCH] Fix traceback in hgweb when URL doesn't end in one of the archive specs

Ali Saidi saidi at eecs.umich.edu
Thu Jun 12 15:43:49 CDT 2008


# HG changeset patch
# User Ali Saidi <saidi at eecs.umich.edu>
# Date 1213303035 14400
# Node ID cc75b6b185dac57d3135582deec269d0d4ff7757
# Parent  d1a312daa5744614a4750cb7aacdbece4f6d8e3a
Fix traceback in hgweb when URL doesn't end in one of the archive specs.

If the last n charecters of the URL doesn't match an entry in archive_specs req.form never has
a key 'type'. When achive() looks up 'type' in the form dict  it causes a traceback rather than
printing an error message.

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -538,7 +538,7 @@ def filelog(web, req, tmpl):
 
 
 def archive(web, req, tmpl):
-    type_ = req.form['type'][0]
+    type_ = req.form.get('type', [None])[0]
     allowed = web.configlist("web", "allow_archive")
     key = req.form['node'][0]
 


More information about the Mercurial-devel mailing list