Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sync with misconfigured push rules #1669

Merged
merged 2 commits into from
Apr 20, 2021
Merged

Conversation

hannojg
Copy link

@hannojg hannojg commented Apr 17, 2021

The issue

A user had some misconfigured push rules, where pattern was not set. This lead to the following error during sync:

ERROR  Caught /sync error TypeError: Cannot read property 'replace' of undefined
    at escapeRegExp
    at globToRegexp
    at createCachedRegex
    at eventFulfillsEventMatchCondition
    at eventFulfillsCondition
    at anonymous
    at matchingRuleFromKindSet
    at matchingRuleForEventWithRulesets
    at pushActionsForEventAndRulesets

the push rule looks like this:

{"actions": ["notify", {"set_tweak": "highlight", "value": false}], "conditions": [{"key": "type", "kind": "event_match"}], "rule_id": "undefined"} env: {"content": {"join_rule": "invite"}, "event_id": undefined, "origin_server_ts": undefined, "room_id": "!yPQVkxldbDQFVCFqcY:redacted.com", "sender": "@e0c1e219-0cd0-48fb-8044-d91167025fa3:redacted.com", "type": "m.room.join_rules", "unsigned": {}}

This fix solves this issue and the processing of the rules can continue (otherwise it looks like it stops when the error happens)

Signed-off-by: Hanno Gödecke [email protected]

@germain-gg germain-gg requested a review from a team April 19, 2021 07:48
@jryans jryans changed the title fix: failure during sync Fix sync with misconfigured push rules Apr 19, 2021
Copy link
Member

@t3chguy t3chguy left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks!

@t3chguy t3chguy merged commit 68206a6 into matrix-org:develop Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants