From f064f751f0b5fb80c2c25c6a28860d3765bde8a6 Mon Sep 17 00:00:00 2001 From: Xiaolan Bot Date: Sun, 22 Feb 2026 11:53:22 +0800 Subject: [PATCH] fix: harden callback payload parsing in add/edit flows --- SubMind.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SubMind.py b/SubMind.py index ad3cb5b..dd02249 100644 --- a/SubMind.py +++ b/SubMind.py @@ -726,7 +726,7 @@ async def add_freq_unit_received(update: Update, context: CallbackContext): await query.edit_message_text("会话已过期,请重新使用 /add_sub 开始。") return ConversationHandler.END - unit = query.data.split('_')[2] + unit = query.data.partition('freq_unit_')[2] if unit not in VALID_FREQ_UNITS: await query.edit_message_text("错误:无效的周期单位,请重试。") return ConversationHandler.END @@ -767,7 +767,7 @@ async def add_renewal_type_received(update: Update, context: CallbackContext): await query.edit_message_text("会话已过期,请重新使用 /add_sub 开始。") return ConversationHandler.END - renewal_type = query.data.split('_')[1] + renewal_type = query.data.partition('renewal_')[2] if renewal_type not in VALID_RENEWAL_TYPES: await query.edit_message_text("错误:无效的续费类型,请重试。") return ConversationHandler.END @@ -1155,7 +1155,7 @@ async def edit_field_selected(update: Update, context: CallbackContext): async def edit_freq_unit_received(update: Update, context: CallbackContext): query = update.callback_query await query.answer() - unit = query.data.split('_')[2] + unit = query.data.partition('freq_unit_')[2] if unit not in VALID_FREQ_UNITS: await query.edit_message_text("错误:无效的周期单位,请重试。") return ConversationHandler.END