From c90262485ffd18a19e8bea4ef1e898722091e223 Mon Sep 17 00:00:00 2001 From: Cp0204 Date: Thu, 5 Dec 2024 16:50:26 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E6=B7=BB=E5=8A=A0=20shareurl=20?= =?UTF-8?q?=E8=A7=A3=E7=A0=81=E7=9A=84=E9=94=99=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加try-catch块以处理decodeURIComponent函数中的潜在错误 --- app/templates/index.html | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/templates/index.html b/app/templates/index.html index 093545f..de5d7d6 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -524,11 +524,16 @@ changeShareurl(task) { if (!task.shareurl) return; + this.$set(task, "shareurl_ban", undefined); // 从URL中提取任务名 - const matches = decodeURIComponent(task.shareurl).match(/\/(\w{32})-([^\/]+)$/); - if (matches) { - task.taskname = task.taskname == "" ? matches[2] : task.taskname; - task.savepath = task.savepath.replace(/TASKNAME/g, matches[2]); + try { + const matches = decodeURIComponent(task.shareurl).match(/\/(\w{32})-([^\/]+)$/); + if (matches) { + task.taskname = task.taskname == "" ? matches[2] : task.taskname; + task.savepath = task.savepath.replace(/TASKNAME/g, matches[2]); + } + } catch (e) { + console.error("Error decodeURIComponent:", e); } // 从分享中提取任务名 axios.get('/get_share_detail', { params: { shareurl: task.shareurl } })