[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [gettor/master] Don't assume that request has "command" key.
commit b3de2e35ea73cc29c4744423a9abe60c9997f5a7
Author: Philipp Winter <phw@xxxxxxxxx>
Date: Fri May 29 16:23:19 2020 -0700
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>
---
gettor/parse/email.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gettor/parse/email.py b/gettor/parse/email.py
index 41b34ce..fa945ba 100644
--- a/gettor/parse/email.py
+++ b/gettor/parse/email.py
@@ -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']
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits