Mercurial > libervia-backend
changeset 3058:0408df45ebe7
plugin OTR: work around a bad exception raised in potr
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 16 Oct 2019 08:39:52 +0200 |
parents | f91d0e6d9b13 |
children | aa728dc7b0ce |
files | sat/plugins/plugin_sec_otr.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/plugins/plugin_sec_otr.py Wed Oct 16 08:39:52 2019 +0200 +++ b/sat/plugins/plugin_sec_otr.py Wed Oct 16 08:39:52 2019 +0200 @@ -637,7 +637,11 @@ next(iter(data["message"].values())) ) # FIXME: Q&D fix for message refactoring, message is now a dict res = otrctx.receiveMessage(message.encode("utf-8")) - except potr.context.UnencryptedMessage: + except (potr.context.UnencryptedMessage, potr.context.NotOTRMessage): + # potr has a bug with Python 3 and test message against str while bytes are + # expected, resulting in a NoOTRMessage raised instead of UnencryptedMessage; + # so we catch NotOTRMessage as a workaround + # TODO: report this upstream encrypted = False if otrctx.state == potr.context.STATE_ENCRYPTED: log.warning(