fix: mitigating WARNING router.py:1421:9 [cfg-resource-leak] — Image.open acquires file handle but not all exit paths release it
Some checks failed
NYX Security Scan / nyx-scan (pull_request) Failing after 6m57s
Some checks failed
NYX Security Scan / nyx-scan (pull_request) Failing after 6m57s
This commit is contained in:
parent
84e3b30f2f
commit
6c869aa305
1 changed files with 20 additions and 20 deletions
|
|
@ -1418,7 +1418,7 @@ def resize_image_if_needed(image_data):
|
|||
pass
|
||||
# Decode the base64 image data
|
||||
image_bytes = base64.b64decode(image_data)
|
||||
image = Image.open(io.BytesIO(image_bytes))
|
||||
with Image.open(io.BytesIO(image_bytes)) as image:
|
||||
if image.mode not in ("RGB", "L"):
|
||||
image = image.convert("RGB")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue