mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-12 23:30:44 +08:00
🐛 添加 shareurl 解码的错误处理
- 添加try-catch块以处理decodeURIComponent函数中的潜在错误
This commit is contained in:
parent
7d8701db0a
commit
c90262485f
@ -524,11 +524,16 @@
|
|||||||
changeShareurl(task) {
|
changeShareurl(task) {
|
||||||
if (!task.shareurl)
|
if (!task.shareurl)
|
||||||
return;
|
return;
|
||||||
|
this.$set(task, "shareurl_ban", undefined);
|
||||||
// 从URL中提取任务名
|
// 从URL中提取任务名
|
||||||
const matches = decodeURIComponent(task.shareurl).match(/\/(\w{32})-([^\/]+)$/);
|
try {
|
||||||
if (matches) {
|
const matches = decodeURIComponent(task.shareurl).match(/\/(\w{32})-([^\/]+)$/);
|
||||||
task.taskname = task.taskname == "" ? matches[2] : task.taskname;
|
if (matches) {
|
||||||
task.savepath = task.savepath.replace(/TASKNAME/g, matches[2]);
|
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 } })
|
axios.get('/get_share_detail', { params: { shareurl: task.shareurl } })
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user