hgweb: fix a stupid KeyError introduced in
a0e20a5eba3c
Thanks to Christian Ebert for finding this. Also added a test to prevent this
from happening again.
--- a/mercurial/hgweb/hgweb_mod.py Tue Jan 22 09:11:06 2008 +0100
+++ b/mercurial/hgweb/hgweb_mod.py Tue Jan 22 09:11:08 2008 +0100
@@ -212,7 +212,7 @@
req.form['cmd'] = [tmpl.cache['default']]
cmd = req.form['cmd'][0]
- if cmd == 'file' and 'raw' in req.form['style']:
+ if cmd == 'file' and 'raw' in req.form.get('style', []):
webcommands.rawfile(self, req, tmpl)
else:
getattr(webcommands, cmd)(self, req, tmpl)
--- a/tests/test-hgweb-commands Tue Jan 22 09:11:06 2008 +0100
+++ b/tests/test-hgweb-commands Tue Jan 22 09:11:08 2008 +0100
@@ -27,6 +27,7 @@
"$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/1/foo/?style=raw'
"$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/annotate/1/foo/?style=raw'
"$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/1/?style=raw'
+"$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/file/1/foo' | sed "s/[0-9]* years/many years/"
"$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT '/filediff/1/foo/?style=raw'
echo % Overviews
Binary file tests/test-hgweb-commands.out has changed