fix: reject JPEG scans without image data
This commit is contained in:
@@ -191,6 +191,30 @@ def test_bad_or_damaged_image_is_415(
|
||||
assert_error(response, 415, "unsupported_media_type")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"data",
|
||||
[
|
||||
bytes.fromhex("ffd8ffc0000b080001000101011100ffda0008010100003f00ffd9"),
|
||||
images.jpeg_with_scan_data(SAMPLE_JPEG),
|
||||
images.jpeg_with_scan_data(SAMPLE_JPEG, b"\xff\xd0\xff\xd1"),
|
||||
images.jpeg_with_scan_data(SAMPLE_JPEG, b"\xff\xff"),
|
||||
],
|
||||
ids=["headers-only", "empty-scan-with-tables", "restart-only", "fill-only"],
|
||||
)
|
||||
def test_jpeg_without_scan_data_is_415(
|
||||
client: httpx.Client, members: dict, data: bytes
|
||||
) -> None:
|
||||
response = upload(
|
||||
client,
|
||||
members["alice"],
|
||||
members["chat"],
|
||||
data,
|
||||
content_type="image/jpeg",
|
||||
filename="bad.jpg",
|
||||
)
|
||||
assert_error(response, 415, "unsupported_media_type")
|
||||
|
||||
|
||||
def test_trailing_bytes_are_part_of_original(
|
||||
client: httpx.Client, members: dict
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user