Fix: gracefully error out for unsupported images (#7478)

Fix for #7459 
## What
Since codex errors out for unsupported images, stop attempting to
base64/attach them and instead emit a clear placeholder when the file
isn’t a supported image MIME.

## Why
Local uploads for unsupported formats (e.g., SVG/GIF/etc.) were
dead-ending after decode failures because of the 400 retry loop. Users
now get an explicit “cannot attach … unsupported image format …”
response.

## How
Replace the fallback read/encode path with MIME detection that bails out
for non-image or unsupported image types, returning a consistent
placeholder. Unreadable and invalid images still produce their existing
error placeholders.
This commit is contained in:
Job Chong authored and GitHub committed 2025-12-09 10:28:41 -08:00
1 parent 9df70a0772
commit ac3237721e
3 files changed
+55 -33

No files matched your search

-1
View File
@@ -1491,7 +1491,6 @@ name = "codex-protocol"
version = "0.0.0"
dependencies = [
"anyhow",
"base64",
"codex-git",
"codex-utils-image",
"icu_decimal",