fix: harden callback payload parsing in add/edit flows
This commit is contained in:
@@ -726,7 +726,7 @@ async def add_freq_unit_received(update: Update, context: CallbackContext):
|
|||||||
await query.edit_message_text("会话已过期,请重新使用 /add_sub 开始。")
|
await query.edit_message_text("会话已过期,请重新使用 /add_sub 开始。")
|
||||||
return ConversationHandler.END
|
return ConversationHandler.END
|
||||||
|
|
||||||
unit = query.data.split('_')[2]
|
unit = query.data.partition('freq_unit_')[2]
|
||||||
if unit not in VALID_FREQ_UNITS:
|
if unit not in VALID_FREQ_UNITS:
|
||||||
await query.edit_message_text("错误:无效的周期单位,请重试。")
|
await query.edit_message_text("错误:无效的周期单位,请重试。")
|
||||||
return ConversationHandler.END
|
return ConversationHandler.END
|
||||||
@@ -767,7 +767,7 @@ async def add_renewal_type_received(update: Update, context: CallbackContext):
|
|||||||
await query.edit_message_text("会话已过期,请重新使用 /add_sub 开始。")
|
await query.edit_message_text("会话已过期,请重新使用 /add_sub 开始。")
|
||||||
return ConversationHandler.END
|
return ConversationHandler.END
|
||||||
|
|
||||||
renewal_type = query.data.split('_')[1]
|
renewal_type = query.data.partition('renewal_')[2]
|
||||||
if renewal_type not in VALID_RENEWAL_TYPES:
|
if renewal_type not in VALID_RENEWAL_TYPES:
|
||||||
await query.edit_message_text("错误:无效的续费类型,请重试。")
|
await query.edit_message_text("错误:无效的续费类型,请重试。")
|
||||||
return ConversationHandler.END
|
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):
|
async def edit_freq_unit_received(update: Update, context: CallbackContext):
|
||||||
query = update.callback_query
|
query = update.callback_query
|
||||||
await query.answer()
|
await query.answer()
|
||||||
unit = query.data.split('_')[2]
|
unit = query.data.partition('freq_unit_')[2]
|
||||||
if unit not in VALID_FREQ_UNITS:
|
if unit not in VALID_FREQ_UNITS:
|
||||||
await query.edit_message_text("错误:无效的周期单位,请重试。")
|
await query.edit_message_text("错误:无效的周期单位,请重试。")
|
||||||
return ConversationHandler.END
|
return ConversationHandler.END
|
||||||
|
|||||||
Reference in New Issue
Block a user