fix(xai): suppress false-positive windows-footgun on binary image read

open(..., "rb") is binary mode and needs no encoding=; the checker's
regex doesn't recognize the mode. Add the documented suppression comment.
This commit is contained in:
teknium1 2026-06-29 20:47:25 -07:00 committed by Teknium
parent 9ce79cd642
commit 5a3d7fb99d

View file

@ -137,7 +137,7 @@ def _xai_image_field(source: str) -> Dict[str, str]:
import base64
import os as _os
with open(_os.path.expanduser(source), "rb") as fh:
with open(_os.path.expanduser(source), "rb") as fh: # windows-footgun: ok
raw = fh.read()
ext = (_os.path.splitext(source)[1].lstrip(".") or "png").lower()
if ext == "jpg":