Unverified Commit b3de2e35 authored by Philipp Winter's avatar Philipp Winter
Browse files

Don't assume that request has "command" key.

If GetTor deals with an autoresponder, it returns an empty request,
which is then passed to parse_callback, which raises a KeyError because
of request["command"]:

2020-05-29 19:04:43+0000 [email parser] Error while parsing email content: [Failure instance: Traceback: <class 'KeyError'>: 'command'
	/usr/lib/python3/dist-packages/twisted/internet/defer.py:311:addCallbacks
	/usr/lib/python3/dist-packages/twisted/internet/defer.py:654:_runCallbacks
	/usr/lib/python3/dist-packages/twisted/internet/defer.py:1613:unwindGenerator
	/usr/lib/python3/dist-packages/twisted/internet/defer.py:1529:_cancellableInlineCallbacks
	--- <exception caught here> ---
	/usr/lib/python3/dist-packages/twisted/internet/defer.py:1418:_inlineCallbacks
	/srv/gettor.torproject.org/home/gettor/gettor/parse/email.py:256:parse_callback
	].

This is a fixup of: <https://bugs.torproject.org/34286>
parent 012ef1a4
......@@ -253,7 +253,7 @@ class EmailParser(object):
dbname = self.settings.get("dbname")
test_hid = self.settings.get("test_hid")
if request["command"]:
if "command" in request:
hid = hashlib.sha256(request['id'].encode('utf-8')).hexdigest()
request_service = request['service']
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment