Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix 500 when joining matrix-dev #2719

Merged
merged 1 commit into from
Nov 29, 2017
Merged

Fix 500 when joining matrix-dev #2719

merged 1 commit into from
Nov 29, 2017

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Nov 28, 2017

matrix-dev has an event ($/6ANj/9QWQyd71N6DpRQPf+SDUu11+HVMeKSpMzBCwM:zemos.net)
which has no hashes member.

Set a default on event.hashes so that we don't fall over later.

@@ -72,6 +72,10 @@ def __init__(self, event_dict, signatures={}, unsigned={},

self._event_dict = event_dict

# some malformed events have no hashes. Avoid throwing exceptions
# later.
event_dict.setdefault("hashes", {})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really don't want to be editing the dict here, as it will invalidate any signatures

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yes. Poop.

any better suggestions? I'm kinda keen to avoid having to do a getattr every time we touch the hashes.

Possibly a _event_dict_property_with_default which builds a property which has a default?

matrix-dev has an event (`$/6ANj/9QWQyd71N6DpRQPf+SDUu11+HVMeKSpMzBCwM:zemos.net`)
which has no `hashes` member.

Check for missing `hashes` element in events.
@richvdh richvdh force-pushed the rav/handle_missing_hashes branch from 3f5ff9f to 7303ed6 Compare November 29, 2017 16:01
@richvdh richvdh merged commit 8b45de9 into develop Nov 29, 2017
@richvdh richvdh deleted the rav/handle_missing_hashes branch November 29, 2017 16:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants