fix(ai): fix URL parsing for ai-apply/ai-dismiss links

The regex pattern (\w+) didn't match 'ai-apply' or 'ai-dismiss' because
\w doesn't include hyphens, causing all AI suggestion buttons to fail.

Fix by handling AI links before the regex match using startsWith().
Remove dead switch cases that were never reached.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
kuaifan 2026-01-21 04:06:40 +00:00
parent 452af4bd2f
commit cb56a01622

View File

@ -94,8 +94,19 @@ export default {
* 处理 dootask://
* 格式: dootask://type/id dootask://type/id1/id2
* 文件链接支持: dootask://file/123 (ID) dootask://file/OSwxLHY3ZlN2R245 (base64)
* AI 建议链接: dootask://ai-apply/{type}/{task_id}/{msg_id} dootask://ai-dismiss/...
*/
handleDooTaskLink(href) {
// AI
if (href.startsWith('dootask://ai-apply/')) {
this.handleAiApply(href);
return;
}
if (href.startsWith('dootask://ai-dismiss/')) {
this.handleAiDismiss(href);
return;
}
const match = href.match(/^dootask:\/\/(\w+)\/([^/]+)(?:\/(\d+))?$/);
if (!match) {
return;
@ -146,14 +157,6 @@ export default {
$A.modalError(msg);
});
break;
case 'ai-apply':
this.handleAiApply(href);
break;
case 'ai-dismiss':
this.handleAiDismiss(href);
break;
}
},