# HG changeset patch # User Dirkjan Ochtman # Date 1200989468 -3600 # Node ID f39110afc03927628225516d8454dc74b7cd356a # Parent df7f66f290b9172a435a9e095932cd78f62e6754 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. diff -r df7f66f290b9 -r f39110afc039 mercurial/hgweb/hgweb_mod.py --- 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) diff -r df7f66f290b9 -r f39110afc039 tests/test-hgweb-commands --- 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 diff -r df7f66f290b9 -r f39110afc039 tests/test-hgweb-commands.out Binary file tests/test-hgweb-commands.out has changed