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

Commit

Permalink
handle single element stream-room-message lists
Browse files Browse the repository at this point in the history
Workaround RocketChat/Rocket.Chat#20801.

Which is to say, upstream made this a list by mistake in 3.8.0, still
hasn't fixed it after 8 point releases and no one can actually determine
if its a bug or not because there's no documentation telling you what to
expect from this stream.  But in 3.12.0, it's reverted, so we need to
handle both.
  • Loading branch information
jsbronder committed Mar 4, 2021
1 parent f24e018 commit 7eb7381
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions wcrc/wcrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,15 @@ async def _process_message(self, jd):

async def _handle_stream_room_messages(self, jd):
msg, room_meta = jd["fields"]["args"]
if isinstance(msg, list):
# Workaround https://github.com/RocketChat/Rocket.Chat/pull/20801
# Which is to say, upstream made this a list by mistake in 3.8.0,
# still hasn't fixed it after 8 point releases and no one can
# actually determine if its a bug or not because there's no
# documentation telling you what to expect from this stream. But
# in 3.12.0, it's reverted, so we need to handle both.
assert len(msg) == 1, json.dumps(msg, sort_keys=True, indent=2)
msg = msg[0]

buf = self._buffers.get(msg["rid"])
if buf is None:
Expand Down

0 comments on commit 7eb7381

Please sign in to comment.