Skip to content

Commit 2c790c0

Browse files
committed
extend() actually works better with a bytes object
1 parent d938bc0 commit 2c790c0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ def publish(self, topic, msg, retain=False, qos=0):
464464

465465
# variable header = 2-byte Topic length (big endian)
466466
pub_hdr_var = bytearray(struct.pack(">H", len(topic)))
467-
pub_hdr_var.append(topic.encode("utf-8")) # Topic name
467+
pub_hdr_var.extend(topic.encode("utf-8")) # Topic name
468468

469469
remaining_length = 2 + len(msg) + len(topic)
470470
if qos > 0:

0 commit comments

Comments
 (0)