[Bugfix][Multimodal] Reject malformed base64 audio with 400 instead of 500 (#53744)
Signed-off-by: mhuzaifa3 <mhuzaifa3@outlook.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user