check invalid file content

This commit is contained in:
hyugogirubato
2025-10-19 19:47:52 +02:00
parent abc69d4673
commit a489ae17fb
+2
View File
@@ -75,6 +75,8 @@ class PageInfo(PageModel):
data = base64.b64decode(data) data = base64.b64decode(data)
if not isinstance(data, bytes): if not isinstance(data, bytes):
raise ValueError(f'Expecting Bytes or Base64 input, got {data!r}') raise ValueError(f'Expecting Bytes or Base64 input, got {data!r}')
if not data.strip():
raise ValueError(f'Empty or null data provided (length={len(data)})')
return cls(data, **kwargs) return cls(data, **kwargs)
@classmethod @classmethod