Repository navigation
Commit b0edb54
fix: Message.getCommand() might return null if text of MessageEntity objects is not computed yet (#1602)
* fix(richtext): serialize RichTextPlain as a bare JSON string
The Bot API defines RichText as "either a String for plain text, an Array
of RichText, or any of the following types" - there is no "plain" type on
the wire. RichTextPlain exists only to give plain text a place in the Java
RichText hierarchy.
RichTextDeserializer already mapped a bare JSON string to RichTextPlain on
the way in, but nothing handled the way out: RichTextPlain had no custom
serializer, so Jackson wrote it as {"type":"plain","text":...}. Telegram
rejected such payloads with:
Bad Request: Can't parse PageBlockTableCell: Unsupported rich text type
Add RichTextPlainSerializer, mirroring the existing RichTextConcatSerializer
for the other library-only pseudo-type. It writes the bare string and
overrides serializeWithType so the @JsonTypeInfo machinery on the RichText
interface cannot re-wrap it in a type envelope.
Reading {"type":"plain",...} keeps working, so JSON persisted by the old
serializer still deserializes.
Fixes #1599
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Bug fixing v10.2.1
* fix: compute text of MessageEntity objects on Message.getCommand()
---------
Co-authored-by: ruben <rberlopez@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Ruben Bermudez <rubenlagus@users.noreply.github.com>1 parent 26e8b35 commit b0edb54
4 files changed
Lines changed: 15 additions & 2 deletions
File tree
- telegrambots-meta/src
- main/java/org/telegram/telegrambots/meta/api/objects
- message
- test/java/org/telegram/telegrambots/meta/test
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
130 | 133 | | |
131 | 134 | | |
132 | 135 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1098 | 1098 | | |
1099 | 1099 | | |
1100 | 1100 | | |
1101 | | - | |
| 1101 | + | |
1102 | 1102 | | |
1103 | 1103 | | |
1104 | 1104 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
199 | 203 | | |
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
461 | 467 | | |
462 | 468 | | |
463 | 469 | | |
| |||
631 | 637 | | |
632 | 638 | | |
633 | 639 | | |
634 | | - | |
| 640 | + | |
0 commit comments