fix: reject JPEG scans without image data

This commit is contained in:
2026-10-30 18:46:03 +03:00
parent 63378b5cf3
commit a2047b59b2
7 changed files with 143 additions and 7 deletions
+24
View File
@@ -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: