From d409bdfe71c9af0b45c108b3126b270ac1a658e8 Mon Sep 17 00:00:00 2001 From: huangjx Date: Thu, 14 Oct 2021 22:45:45 +0800 Subject: [PATCH] fixed bugs related to action buttons --- lib/Controller/Aria2Controller.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Controller/Aria2Controller.php b/lib/Controller/Aria2Controller.php index 4f968a5..b2816f0 100644 --- a/lib/Controller/Aria2Controller.php +++ b/lib/Controller/Aria2Controller.php @@ -92,8 +92,14 @@ class Aria2Controller extends Controller } } if (in_array($action, ['removeDownloadResult', 'remove'])) { - if (isset($resp['result']) && strtolower($resp['result']) === 'ok') { - return ['message' => $this->l10n->t("DONE!"), 'status' => 1]; + $result = $resp['result'] ?? null; + if (isset($result)) { + if (strtolower($result) === 'ok') { + return ['message' => $this->l10n->t("DONE!"), 'status' => 1]; + } + if (is_string($result)) { + return ['message' => $this->l10n->t($result), 'status' => 1]; + } } else { return ['error' => $this->l10n->t("FAILED!"), 'status' => 0]; }