From 3c2ccf7d40525d3f8c5e6f3943d2e7cfc39fc67b Mon Sep 17 00:00:00 2001 From: bggRGjQaUbCoE Date: Mon, 10 Feb 2025 13:31:50 +0800 Subject: [PATCH] mod: check av/bv search Signed-off-by: bggRGjQaUbCoE --- lib/pages/search_panel/controller.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pages/search_panel/controller.dart b/lib/pages/search_panel/controller.dart index 3c20a332..2443f62d 100644 --- a/lib/pages/search_panel/controller.dart +++ b/lib/pages/search_panel/controller.dart @@ -64,11 +64,13 @@ class SearchPanelController extends CommonController { void onPushDetail(resultList) async { // 匹配输入内容,如果是AV、BV号且有结果 直接跳转详情页 - Map matchRes = IdUtils.matchAvorBv(input: keyword); - if (matchRes.isNotEmpty) { + if (RegExp(r'^(av\d+|bv[a-z\d]{10})$', caseSensitive: false) + .hasMatch(keyword)) { + Map matchRes = IdUtils.matchAvorBv(input: keyword); PiliScheme.videoPush(matchRes['AV'], matchRes['BV'], false); return; } + // keyword 可能输入纯数字 try { int? aid = int.tryParse(keyword);