Pytdbot 1.0.0b2__tar.gz → 1.0.0b3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/PKG-INFO +1 -1
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/Pytdbot.egg-info/PKG-INFO +1 -1
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/__init__.py +1 -1
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/utils/json_utils.py +9 -4
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_utils_json.py +9 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/LICENSE +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/MANIFEST.in +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/Pytdbot.egg-info/SOURCES.txt +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/Pytdbot.egg-info/dependency_links.txt +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/Pytdbot.egg-info/entry_points.txt +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/Pytdbot.egg-info/requires.txt +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/Pytdbot.egg-info/top_level.txt +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/README.md +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pyproject.toml +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/ai/SKILL.md +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/ai/__init__.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/ai/helpers.json +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/ai/lookup.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/client.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/client_manager.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/docs.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/exception/__init__.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/filters.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/handlers/__init__.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/handlers/decorators.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/handlers/handler.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/handlers/td_updates.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/methods/__init__.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/methods/methods.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/methods/td_functions.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/td_api.json +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/tdjson/__init__.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/tdjson/tdjson.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/types/__init__.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/types/bound_methods/__init__.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/types/bound_methods/callback_query.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/types/bound_methods/chatActions.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/types/bound_methods/file.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/types/bound_methods/message.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/types/bound_methods/sender_id.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/types/bound_methods/widget_query.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/types/plugins/__init__.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/types/td_types.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/types/tdserver/__init__.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/types/tdserver/schedule.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/types/tdserver/stats.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/utils/__init__.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/utils/albums.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/utils/common.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/utils/diff.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/utils/escape.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/utils/obj_encoder.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/utils/rich_converter.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/utils/rich_messages.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/utils/strings.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/utils/text_format.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/pytdbot/utils/webapps.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/setup.cfg +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_client.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_error.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_filters.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_send.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_utils_albums.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_utils_common.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_utils_diff.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_utils_escape.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_utils_obj.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_utils_rich.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_utils_strings.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_utils_text_format.py +0 -0
- {pytdbot-1.0.0b2 → pytdbot-1.0.0b3}/tests/test_utils_webapps.py +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from html import unescape
|
|
1
2
|
from typing import Any
|
|
2
3
|
|
|
3
4
|
try:
|
|
@@ -52,12 +53,16 @@ def load_callback_data(data: bytes) -> CallbackData:
|
|
|
52
53
|
|
|
53
54
|
try:
|
|
54
55
|
d = json_loads(data)
|
|
55
|
-
if not isinstance(d, list) or len(d) != 2:
|
|
56
|
-
return empty_callback_data
|
|
57
56
|
except (ValueError, TypeError):
|
|
57
|
+
try:
|
|
58
|
+
d = json_loads(unescape(data.decode("utf-8")))
|
|
59
|
+
except (ValueError, TypeError, UnicodeDecodeError):
|
|
60
|
+
return empty_callback_data
|
|
61
|
+
|
|
62
|
+
if not isinstance(d, list) or len(d) != 2:
|
|
58
63
|
return empty_callback_data
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
|
|
65
|
+
return CallbackData(*d)
|
|
61
66
|
|
|
62
67
|
|
|
63
68
|
def callback_data(action: Any, data: Any = None) -> bytes:
|
|
@@ -27,6 +27,15 @@ def test_load_callback_data_invalid_returns_empty():
|
|
|
27
27
|
assert utils.empty_callback_data.action == ""
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
def test_load_callback_data_html_escaped():
|
|
31
|
+
raw = utils.callback_data("th", (1088394097, "AiRXEpaarTg"))
|
|
32
|
+
escaped = raw.replace(b'"', b""")
|
|
33
|
+
|
|
34
|
+
loaded = utils.load_callback_data(escaped)
|
|
35
|
+
assert loaded.action == "th"
|
|
36
|
+
assert loaded.data == [1088394097, "AiRXEpaarTg"]
|
|
37
|
+
|
|
38
|
+
|
|
30
39
|
def test_callback_data_too_large():
|
|
31
40
|
with pytest.raises(ValueError, match="less than 64 bytes"):
|
|
32
41
|
utils.callback_data("x" * 70)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|