This commit is contained in:
2026-10-30 21:09:56 +03:00
parent ec540a1a72
commit 3223dd469a
87 changed files with 15475 additions and 33 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
# Truncated / corrupt PNG → 415 (not 500).
set -eu
. "$(dirname "$0")/lib.sh"
register_user alice
create_chat 'corrupt' "[\"$USER_ID\"]"
bad=$(mktemp)
# PNG magic + IHDR-looking garbage, truncated — fails stbi decode.
printf '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x01\x00\x00\x00\x01\x00\x08\x02\x00\x00\x00' > "$bad"
upload_file "$CHAT_ID" "$bad" 'broken.png' 'image/png'
rm -f "$bad"
expect_code 415
code=$(printf '%s' "$HTTP_BODY" | jq -r .error.code)
assert_eq "$code" unsupported_media_type error_code
printf 'PASS test_attachment_corrupted\n'