fix: validate required schema and support bounded JPEG file objects
This commit is contained in:
@@ -199,3 +199,17 @@ def test_truncated_jpeg_with_forged_eoi(scenario):
|
||||
mime="image/jpeg",
|
||||
status=415,
|
||||
)
|
||||
|
||||
|
||||
def test_internal_jpeg_bytesio_fallback():
|
||||
import shutil
|
||||
|
||||
from messenger.attachments import validate_image
|
||||
|
||||
if shutil.which("djpeg") is None:
|
||||
pytest.skip(
|
||||
"Internal BytesIO helper requires host djpeg; HTTP JPEG validation runs in Docker regardless"
|
||||
)
|
||||
stream = BytesIO(image_bytes("JPEG"))
|
||||
assert validate_image(stream, "image/jpeg") == ("image/jpeg", 32, 20)
|
||||
assert stream.tell() == 0
|
||||
|
||||
Reference in New Issue
Block a user