From dc27d4ad1637713feb6792a182f7ecd29a47b9d7 Mon Sep 17 00:00:00 2001 From: ryzendigo <48058157+ryzendigo@users.noreply.github.com> Date: Tue, 17 Mar 2026 07:34:30 +0800 Subject: [PATCH] fix: upload_image parses response body before checking HTTP status (#22475) * 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. * style: remove extra blank line for ruff --- frigate/plus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frigate/plus.py b/frigate/plus.py index 197b6e48d..2870d2ae5 100644 --- a/frigate/plus.py +++ b/frigate/plus.py @@ -105,9 +105,9 @@ 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)}