From 3775f39b6e7cc2f4e7a1264f0dbdd1a14b90fb1e Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Sun, 30 Jul 2023 02:39:45 +0800 Subject: [PATCH] api pieces-hash keeps return map --- app/Exceptions/Handler.php | 2 +- app/Http/Controllers/TorrentController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index e13b4ab69..59151cd2c 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -55,7 +55,7 @@ public function register() } $this->renderable(function (AuthenticationException $e) { - return response()->json(fail($e->getMessage(), $e->guards()), 401); + return response()->json(fail($e->getMessage(), ['guards' => $e->guards()]), 401); }); $this->renderable(function (UnauthorizedException $e) { diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index cb8e74f3f..9fb0615b4 100644 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -154,7 +154,7 @@ public function queryByPiecesHash(Request $request) 'pieces_hash' => 'required|array', ]); $result = $this->repository->getPiecesHashCache($request->pieces_hash); - return $this->success($result); + return $this->success($result ?: (object)[]); } }