From 6e3444424792efb962e88ab0ea1514f61c79f1f5 Mon Sep 17 00:00:00 2001 From: Rhilip Date: Sun, 13 Feb 2022 14:48:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DDSM7=E5=87=BA=E7=8E=B0?= =?UTF-8?q?101=E6=8A=A5=E9=94=99=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../clients/synologyDownloadStation/init.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/resource/clients/synologyDownloadStation/init.js b/resource/clients/synologyDownloadStation/init.js index 380f3b0d9..68f51bad8 100644 --- a/resource/clients/synologyDownloadStation/init.js +++ b/resource/clients/synologyDownloadStation/init.js @@ -104,23 +104,21 @@ } let postData = { - _sid: this.sessionId, api: 'SYNO.DownloadStation2.Task', method: 'create', version: 2, - create_list: false + create_list: false, + _sid: this.sessionId // fxxk, _sid 参数不能放在第一位,不然会直接 101 报错 } - if (options.savePath) { - let savePath = options.savePath + ""; - // 去除路径最后的 / ,以确保可以正常添加目录信息 - if (savePath.substr(-1) == "/") { - savePath = savePath.substr(0, savePath.length - 1); - } - postData.destination = `"${savePath || ''}"`; + // fxxk, 没有 destination 参数也会直接报错 + let savePath = (options.savePath || "") + ""; + if (savePath.substr(-1) === "/") { // 去除路径最后的 / ,以确保可以正常添加目录信息 + savePath = savePath.substr(0, savePath.length - 1); } + postData.destination = `"${savePath || ''}"`; - if (options.url.startWith('magnet:')) { + if (options.url.startsWith('magnet:')) { postData.type = '"url"'; postData.url = [options.url];