lab4
This commit is contained in:
Executable
+19
@@ -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'
|
||||
Reference in New Issue
Block a user