From ab332c0395cecdd71d0f011affbf329427aa972f Mon Sep 17 00:00:00 2001 From: ryzendigo <48058157+ryzendigo@users.noreply.github.com> Date: Mon, 16 Mar 2026 14:47:53 +0800 Subject: [PATCH] fix: check HTTP response status before parsing JSON body upload_image() calls r.json() before checking r.ok. If the server returns an error response (401, 500, etc) with a non-JSON body, this raises a confusing JSONDecodeError instead of the intended 'Unable to get signed urls' error message. Move the r.ok check before the r.json() call. --- frigate/plus.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frigate/plus.py b/frigate/plus.py index 197b6e48d..86df71a9b 100644 --- a/frigate/plus.py +++ b/frigate/plus.py @@ -105,9 +105,10 @@ class PlusApi: def upload_image(self, image: ndarray, camera: str) -> str: r = self._get("image/signed_urls") - presigned_urls = r.json() + if not r.ok: raise Exception("Unable to get signed urls") + presigned_urls = r.json() # resize and submit original files = {"file": get_jpg_bytes(image, 1920, 85)}