[issue2730] hgwebdir_mod fails with KeyError on manipulated annotate URLs

Pascal Volk bugs at mercurial.selenic.com
Sat Mar 26 20:37:15 UTC 2011


New submission from Pascal Volk <user+mercurial at localhost.localdomain.org>:

Commonly a annotate URL looks like http://host/repo/annotate/rev/file.
When the file path is invalid the HTTP status 404 will be sent to the
client.
But when the file part was omitted the following error occurs:

mod_wsgi (pid=9005): Exception occurred processing WSGI script
'/srv/www/hg.example.org/dir/hgwebdir.wsgi'.
Traceback (most recent call last):
  File "/path/2/mercurial/hgweb/hgwebdir_mod.py", line 116, in __call__
    return self.run_wsgi(req)
  File "/path/2/mercurial/hgweb/hgwebdir_mod.py", line 174, in run_wsgi
    return hgweb(repo).run_wsgi(req)
  File "/path/2/mercurial/hgweb/hgweb_mod.py", line 190, in run_wsgi
    content = getattr(webcommands, cmd)(self, req, tmpl)
  File "/path/2/mercurial/extensions.py", line 178, in wrap
    return wrapper(origfn, *args, **kwargs)
  File "/path/2/hgext/highlight/__init__.py", line 45, in annotate_highlight
    fctx = webutil.filectx(web.repo, req)
  File "/path/2/mercurial/hgweb/webutil.py", line 141, in filectx
    path = cleanpath(repo, req.form['file'][0])
KeyError: 'file'


I guess the problem should be fixed and when the file part is missing
the HTTP status 400 should be send.

`hg version`:  Mercurial Distributed SCM (version 1.8.1)
`uname -orsm`: Linux 2.6.32-5-amd64 x86_64 GNU/Linux


Regards,
Pascal

----------
messages: 15838
nosy: pvo
priority: bug
status: unread
title: hgwebdir_mod fails with KeyError on manipulated annotate URLs

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2730>
____________________________________________________


More information about the Mercurial-devel mailing list