Fix some edge case crashes of `handle_send` when there are Diaspora protocol receivers

merge-requests/159/merge
Jason Robinson 2020-01-12 23:33:49 +02:00
rodzic 6bc85a3bfa
commit 4c665e8743
2 zmienionych plików z 9 dodań i 5 usunięć

Wyświetl plik

@ -21,7 +21,9 @@
* Loosen validation of `TargetIDMixin`, it now requires one of the target attributes
to be set, not just `target_id`. This fixes follows over the Diaspora protocol which
broke with stricter send validation added in 0.19.0.
broke with stricter send validation added in 0.19.0.
* Fix some edge case crashes of `handle_send` when there are Diaspora protocol receivers.
## [0.19.0] - 2019-12-15

Wyświetl plik

@ -184,22 +184,24 @@ def handle_send(
if skip_ready_payload["diaspora"]:
continue
if public_key:
raise ValueError("handle_send - Diaspora recipient cannot be public and use encrypted delivery")
logger.warning("handle_send - Diaspora recipient cannot be public and use encrypted delivery")
continue
if not ready_payloads[protocol]["payload"]:
try:
# noinspection PyTypeChecker
ready_payloads[protocol]["payload"] = handle_create_payload(
entity, author_user, protocol, parent_user=parent_user,
)
except ValueError as ex:
except Exception as ex:
# No point continuing for this protocol
skip_ready_payload["diaspora"] = True
logger.warning("handle_send - skipping diaspora due to failure to generate payload: %s", ex)
ready_payloads["diaspora"]["urls"].add(endpoint)
else:
if not public_key:
raise ValueError("handle_send - Diaspora recipient cannot be private without a public key for "
"encrypted delivery")
logger.warning("handle_send - Diaspora recipient cannot be private without a public key for "
"encrypted delivery")
continue
# Private payload
try:
payload = handle_create_payload(