From a6280336373394b43eac7c9e0f1ad65c3878e76e Mon Sep 17 00:00:00 2001 From: Yat Ho Date: Fri, 6 Feb 2026 10:43:09 +0800 Subject: [PATCH] fix(web): exception from destructing undefined property (#8374) --- web/src/remote.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/web/src/remote.js b/web/src/remote.js index a71f4fad4..3805037ee 100644 --- a/web/src/remote.js +++ b/web/src/remote.js @@ -21,6 +21,10 @@ export const RPC = { _UpSpeedLimited: 'speed_limit_up_enabled', }; +function getResponseParams(response) { + return response.result ?? response.error.data.result; +} + export class Remote { _connection_alert = null; _session_id = ''; @@ -163,8 +167,8 @@ export class Remote { o.params.ids = torrentIds; } this.sendRequest(o, (response) => { - const { torrents, removed } = response.result; - callback.call(context, torrents, removed); + const res = getResponseParams(response); + callback.call(context, res.torrents, res.removed); }); } @@ -176,8 +180,8 @@ export class Remote { params: { path: dir }, }; this.sendRequest(o, (response) => { - const { path, size_bytes } = response.result; - callback.call(context, path, size_bytes); + const res = getResponseParams(response); + callback.call(context, res.path, res.size_bytes); }); }