core: fix calls to domish.Element.elements:

domish.Element.elements should be called with namespace and element name as 2 arguments,
but it has been confused in several places with the call to `domish.Element.addElement`
which is often done with a `(namespace, name)` tuple. Unfortunately calling with a tuple
is accepted and doesn't raise any error in `elements`, but this result in a wrong element
returned.

This patch fixes the erroneous calls.
This commit is contained in:
Goffi 2022-07-20 17:12:29 +02:00
commit 8d64157d88

View file

@ -248,7 +248,7 @@ class AttachPlugin:
async def defaultAttach(self, client, data):
await self.uploadFiles(client, data)
# TODO: handle xhtml-im
body_elt = next(data["xml"].elements((C.NS_CLIENT, "body")))
body_elt = next(data["xml"].elements(C.NS_CLIENT, "body"))
attachments = data["extra"][C.MESS_KEY_ATTACHMENTS]
if attachments:
body_links = '\n'.join(a['url'] for a in attachments)