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.
This commit is contained in:
parent
e5a0948b71
commit
06503f83aa
1 changed files with 7 additions and 4 deletions
|
|
@ -24,7 +24,6 @@ from urllib import parse
|
|||
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 @@ class XEP_0363:
|
|||
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}")
|
||||
|
|
|
|||
Loading…
Reference in a new issue