mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-11-19 10:39:26 +01:00
Fail request early if message/caption/explanation text is too long.
This commit is contained in:
parent
1ec733a3f8
commit
df1fe4c05f
@ -7240,6 +7240,10 @@ td::Result<td_api::object_ptr<td_api::textEntity>> Client::get_text_entity(td::J
|
|||||||
|
|
||||||
td::Result<td_api::object_ptr<td_api::formattedText>> Client::get_formatted_text(td::string text, td::string parse_mode,
|
td::Result<td_api::object_ptr<td_api::formattedText>> Client::get_formatted_text(td::string text, td::string parse_mode,
|
||||||
td::JsonValue &&input_entities) {
|
td::JsonValue &&input_entities) {
|
||||||
|
if (text.size() > (1 << 15)) {
|
||||||
|
return td::Status::Error(400, "Text is too long");
|
||||||
|
}
|
||||||
|
|
||||||
td::to_lower_inplace(parse_mode);
|
td::to_lower_inplace(parse_mode);
|
||||||
if (!text.empty() && !parse_mode.empty() && parse_mode != "none") {
|
if (!text.empty() && !parse_mode.empty() && parse_mode != "none") {
|
||||||
object_ptr<td_api::TextParseMode> text_parse_mode;
|
object_ptr<td_api::TextParseMode> text_parse_mode;
|
||||||
|
Loading…
Reference in New Issue
Block a user