mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-17 21:58:22 +03:00
fix: upload_image parses response body before checking HTTP status (#22475)
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
Some checks are pending
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / Jetson Jetpack 6 (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
* 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
This commit is contained in:
parent
7708523865
commit
dc27d4ad16
@ -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)}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user