changeset 6669:782dbbdfb1d7

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.
author Ali Saidi <saidi@eecs.umich.edu>
date Fri, 13 Jun 2008 12:33:40 +0200
parents 22c303a514f8
children be55b1a6d4b1 1eba8e8f2cce
files mercurial/hgweb/webcommands.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Thu Jun 12 00:11:09 2008 -0700
+++ b/mercurial/hgweb/webcommands.py	Fri Jun 13 12:33:40 2008 +0200
@@ -109,7 +109,7 @@
     return web.filelog(tmpl, web.filectx(req))
 
 def archive(web, req, tmpl):
-    type_ = req.form['type'][0]
+    type_ = req.form.get('type', [None])[0]
     allowed = web.configlist("web", "allow_archive")
     if (type_ in web.archives and (type_ in allowed or
         web.configbool("web", "allow" + type_, False))):