Skip to content

Commit a8fecc5

Browse files
pulsastrixtsnoam
authored andcommitted
Prevented modifications to the request object's original data (python-telegram-bot#454)
fixes python-telegram-bot#357
1 parent c3984e1 commit a8fecc5

17 files changed

+33
-3
lines changed

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The following wonderful people contributed directly or indirectly to this projec
1515
- `ErgoZ Riftbit Vaper <https://github.com/ergoz>`_
1616
- `Eugene Lisitsky <https://github.com/lisitsky>`_
1717
- `franciscod <https://github.com/franciscod>`_
18+
- `Hugo Damer <https://github.com/HakimusGIT>`_
1819
- `Jacob Bom <https://github.com/bomjacob>`_
1920
- `JASON0916 <https://github.com/JASON0916>`_
2021
- `jh0ker <https://github.com/jh0ker>`_

telegram/animation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ def de_json(data, bot):
5555
if not data:
5656
return None
5757

58+
data = super(Animation, Animation).de_json(data, bot)
59+
5860
data['thumb'] = PhotoSize.de_json(data.get('thumb'), bot)
5961

6062
return Animation(**data)

telegram/callbackquery.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ def de_json(data, bot):
6060
if not data:
6161
return None
6262

63+
data = super(CallbackQuery, CallbackQuery).de_json(data, bot)
64+
6365
data['from_user'] = User.de_json(data.get('from'), bot)
6466
data['message'] = Message.de_json(data.get('message'), bot)
6567

telegram/chatmember.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def de_json(data, bot):
5959
if not data:
6060
return None
6161

62+
data = super(ChatMember, ChatMember).de_json(data, bot)
63+
6264
data['user'] = User.de_json(data.get('user'), bot)
6365

6466
return ChatMember(**data)

telegram/choseninlineresult.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ def de_json(data, bot):
7474
if not data:
7575
return None
7676

77-
# Required
77+
data = super(ChosenInlineResult, ChosenInlineResult).de_json(data, bot)
78+
# Required
7879
data['from_user'] = User.de_json(data.pop('from'), bot)
7980
# Optionals
8081
data['location'] = Location.de_json(data.get('location'), bot)

telegram/document.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def de_json(data, bot):
6363
if not data:
6464
return None
6565

66+
data = super(Document, Document).de_json(data, bot)
67+
6668
data['thumb'] = PhotoSize.de_json(data.get('thumb'), bot)
6769

6870
return Document(**data)

telegram/game.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ def de_json(data, bot):
7373
if not data:
7474
return None
7575

76+
data = super(Game, Game).de_json(data, bot)
77+
7678
data['photo'] = PhotoSize.de_list(data.get('photo'), bot)
7779
data['text_entities'] = MessageEntity.de_list(data.get('text_entities'), bot)
7880
data['animation'] = Animation.de_json(data.get('animation'), bot)

telegram/gamehighscore.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def de_json(data, bot):
4949
if not data:
5050
return None
5151

52+
data = super(GameHighScore, GameHighScore).de_json(data, bot)
53+
5254
data['user'] = User.de_json(data.get('user'), bot)
5355

5456
return GameHighScore(**data)

telegram/message.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ def de_json(data, bot):
200200
if not data:
201201
return None
202202

203+
data = super(Message, Message).de_json(data, bot)
204+
203205
data['from_user'] = User.de_json(data.get('from'), bot)
204206
data['date'] = datetime.fromtimestamp(data['date'])
205207
data['chat'] = Chat.de_json(data.get('chat'), bot)

telegram/replykeyboardmarkup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ def de_json(data, bot):
6767
if not data:
6868
return None
6969

70+
data = super(ReplyKeyboardMarkup, ReplyKeyboardMarkup).de_json(data, bot)
71+
7072
data['keyboard'] = [KeyboardButton.de_list(keyboard, bot) for keyboard in data['keyboard']]
7173

7274
return ReplyKeyboardMarkup(**data)

0 commit comments

Comments
 (0)