fix: bound template storage and callback data

This commit is contained in:
2026-09-25 01:49:31 +08:00
parent 2045c3cea1
commit 9d40f3bc50
3 changed files with 169 additions and 27 deletions
+15
View File
@@ -936,6 +936,21 @@ mod tests {
);
}
#[test]
fn edit_markup_omits_names_that_exceed_callback_data() {
let allowed: HashMap<String, String> =
[("x".repeat(55), "[]".to_string())].into_iter().collect();
let allowed_markup = build_edit_markup(&allowed);
assert_eq!(allowed_markup.inline_keyboard.len(), 2);
assert_eq!(allowed_markup.inline_keyboard[0].len(), 1);
let too_long: HashMap<String, String> =
[("x".repeat(56), "[]".to_string())].into_iter().collect();
let rejected_markup = build_edit_markup(&too_long);
assert_eq!(rejected_markup.inline_keyboard.len(), 1);
assert_eq!(rejected_markup.inline_keyboard[0].len(), 2);
}
#[test]
fn failure_text_names_the_post_and_the_cause() {
// A send failure names the post (the cache key) and the cause, so the