From af937152a108aa187a04c1b10d35e1bb8383130c Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 4 Nov 2018 09:36:21 +0100 Subject: [PATCH] Don't decode inline buttons callback data Clients are able to set any value as plain bytes, this means UTF-8 decoding could fail. --- pyrogram/client/types/bots/inline_keyboard_button.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrogram/client/types/bots/inline_keyboard_button.py b/pyrogram/client/types/bots/inline_keyboard_button.py index 0f4779a9..ce93d96b 100644 --- a/pyrogram/client/types/bots/inline_keyboard_button.py +++ b/pyrogram/client/types/bots/inline_keyboard_button.py @@ -31,7 +31,7 @@ class InlineKeyboardButton(Object): text (``str``): Label text on the button. - callback_data (``str``, *optional*): + callback_data (``bytes``, *optional*): Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes. url (``str``, *optional*): @@ -85,7 +85,7 @@ class InlineKeyboardButton(Object): if isinstance(b, KeyboardButtonCallback): return InlineKeyboardButton( text=b.text, - callback_data=b.data.decode() + callback_data=b.data ) if isinstance(b, KeyboardButtonSwitchInline):