plugin pubsub signature: fix attachment setting + default signer:

- attachment setting was crashing when `item_elt` was not specified due to argument typo
- if `signer` is set to None in attachment data, client's bare jid will be used to sign
  the item

rel 381
This commit is contained in:
Goffi 2022-10-30 01:06:58 +02:00
commit 0988c73644

View file

@ -255,7 +255,7 @@ class PubsubSigning:
node = attachments_data["node"]
item_id = attachments_data["id"]
items, __ = await self._p.getItems(
client, service, node, items_ids=[item_id]
client, service, node, item_ids=[item_id]
)
if not items != 1:
raise exceptions.NotFound(
@ -263,7 +263,7 @@ class PubsubSigning:
)
item_elt = items[0]
signer = signature_data["signer"]
signer = signature_data.get("signer") or client.jid.userhost()
timestamp = time.time()
timestamp_xmpp = utils.xmpp_date(timestamp)
to_sign = self.get_data_to_sign(item_elt, service, timestamp, signer)