[Bugfix][Multimodal] Reject malformed base64 audio with 400 instead of 500 (#53744)

Signed-off-by: mhuzaifa3 <mhuzaifa3@outlook.com>
This commit is contained in:
Moe Huzaifa
2026-08-25 17:31:42 +00:00
committed by GitHub
parent 7de96050c5
commit 299ebd094a
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -309,7 +309,7 @@ class AudioMediaIO(MediaIO[tuple[npt.NDArray, float]]):
parameter="audio_filesize_mb",
value=(len(data) * 3 / 4) / MiB_bytes,
)
return self.load_bytes(pybase64.b64decode(data))
return self.load_bytes(pybase64.b64decode(data, validate=True))
def load_file(self, filepath: Path) -> tuple[npt.NDArray, float]:
self._validate_encoded_size(filepath.stat().st_size)