mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-26 20:48:12 +00:00
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:
parent
452af4bd2f
commit
cb56a01622
@ -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;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user