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

Possible spec violation? m.room.message with empty content field #6225

Closed
hugecheese opened this issue Oct 20, 2019 · 3 comments
Closed

Possible spec violation? m.room.message with empty content field #6225

hugecheese opened this issue Oct 20, 2019 · 3 comments

Comments

@hugecheese
Copy link

hugecheese commented Oct 20, 2019

When doing my initial /sync from the https://matrix.org homeserver, I got back the following event:

{
  "content": {},
  "event_id": "$BPPs0MTfE4y-8F58bmvITRM7rz4YATGtOvBcQhPBWaY",
  "origin_server_ts": 1571015847357,
  "sender": "@bowdown097:matrix.org",
  "type": "m.room.message",
  "unsigned": {
    "age": 513533411,
    "redacted_because": {
      "content": {},
      "event_id": "$QjO7JJsn_KmuudfkpSLr-TYOT7BuemfwzsbsIuI5qtc",
      "origin_server_ts": 1571016502195,
      "redacts": "$BPPs0MTfE4y-8F58bmvITRM7rz4YATGtOvBcQhPBWaY",
      "sender": "@bowdown097:matrix.org",
      "type": "m.room.redaction",
      "unsigned": {
        "age": 512878573
      }
    },
    "redacted_by": "$QjO7JJsn_KmuudfkpSLr-TYOT7BuemfwzsbsIuI5qtc"
  }
}

The spec states that any event with the type m.room.message must always have the body and msgtype fields.

@turt2live
Copy link
Member

The event was redacted, so this is expected.

@hugecheese
Copy link
Author

@turt2live I see, but why aren't the fields marked as optional? If they might not be present because of a redaction, then I don't think they should be marked as Required

@turt2live
Copy link
Member

That's where the spec is a bit unclear: I believe the theory is that the fields are required to send, but not receive. A redaction affects the event in ways after it has been sent, so it naturally can force the event to lose otherwise required fields.

In practice, implementations should be resilient to malformed event contents.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants