Skip to content

Commit

Permalink
FIX charset=None was causing SubscriberProtocol.messageReceived to ne…
Browse files Browse the repository at this point in the history
…ver be called

If the charset = None in SubscriberProtocol then SubscriberProtocol .replyReceived will never call SubscriberProtocol.messageReceived due to u"message" when received will not match b"message" and u"pmessage" will not match b"pmessage" inside the if clauses therefore the code where messageReceived is called will never be reached. This is due to types of str and bytes will not match each other even if similar values are inside
  • Loading branch information
EllieTheYeen committed Jul 5, 2023
1 parent c541750 commit 2910ab4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions txredisapi.py
Expand Up @@ -1916,9 +1916,9 @@ def messageReceived(self, pattern, channel, message):
def replyReceived(self, reply):
if isinstance(reply, list):
reply_len = len(reply)
if reply_len >= 3 and reply[-3] == u"message":
if reply_len >= 3 and reply[-3] in (u"message", b"message"):
self.messageReceived(None, *reply[-2:])
elif reply_len >= 4 and reply[-4] == u"pmessage":
elif reply_len >= 4 and reply[-4] in (u"pmessage", b"pmessage"):
self.messageReceived(*reply[-3:])
elif reply_len >= 3 and reply[-3] in self._sub_unsub_reponses and len(self.replyQueue.waiting) == 0:
pass
Expand Down

0 comments on commit 2910ab4

Please sign in to comment.