caption: escape URLs/handles in HTML captions

Post URLs and author URLs were interpolated raw into <a href> attributes
(and the raw user URL from empty_fetched into caption text), so crafted
links could break the HTML parse and fail the send with a 400. All
attribute interpolations now use encode_double_quoted_attribute; text
stays encode_text.
This commit is contained in:
2026-08-08 20:21:56 +08:00
parent 734cfc2eb3
commit 72130b9023
4 changed files with 13 additions and 11 deletions
+1 -1
View File
@@ -162,7 +162,7 @@ async fn edit_message_handler(bot: &Bot, message: &Message) -> bool {
};
let link = format!(
"<a href=\"{0}\">{1}</a>",
edit.url,
html_escape::encode_double_quoted_attribute(&edit.url),
html_escape::encode_text(text)
);
let new_text = if edit.template.is_empty() {