# HG changeset patch # User Goffi # Date 1605189195 -3600 # Node ID 506fa3d91d3a16edf8cbd1fccd9f5cf0338236a4 # Parent 467d6c709f1dfa0ebd751d8de13d4b3e729abebd plugin XEP-0363: fixed invalid reference to `slot` in catched exception: `slot` was referenced in an exception where it can't exist. This fix avoid a crash and skip the handler when a StanzaError is catched. diff -r 467d6c709f1d -r 506fa3d91d3a sat/plugins/plugin_xep_0363.py --- a/sat/plugins/plugin_xep_0363.py Thu Nov 12 14:53:15 2020 +0100 +++ b/sat/plugins/plugin_xep_0363.py Thu Nov 12 14:53:15 2020 +0100 @@ -24,7 +24,6 @@ from wokkel import disco, iwokkel from zope.interface import implementer from twisted.words.protocols.jabber import jid, xmlstream, error -from twisted.words.xish import domish from twisted.internet import reactor from twisted.internet import defer from twisted.web import client as http_client @@ -375,13 +374,17 @@ try: slot = handler.callback(client, request) except error.StanzaError as e: - log.warning(f"a stanza error has been raised while processing HTTP Upload of request: {e}") + log.warning( + "a stanza error has been raised while processing HTTP Upload of " + f"request: {e}" + ) if err is None: # we keep the first error to return its condition later, # if no other callback handle the request err = e - if slot: - break + else: + if slot: + break else: log.warning( _("no service can handle HTTP Upload request: {elt}")