Skip to content

fix: treat image file extensions as case-insensitive - #5588

Closed
tonycoder-hub wants to merge 1 commit into
Aider-AI:mainfrom
tonycoder-hub:cursor/fix-image-file-extension-case-c288
Closed

fix: treat image file extensions as case-insensitive#5588
tonycoder-hub wants to merge 1 commit into
Aider-AI:mainfrom
tonycoder-hub:cursor/fix-image-file-extension-case-c288

Conversation

@tonycoder-hub

Copy link
Copy Markdown

Summary

is_image_file() compared filenames against the lowercase IMAGE_EXTENSIONS set with str.endswith(), so DSC_0001.JPG and scan.PDF were treated as text. InputOutput.read_text() then opened the binary as text (UnicodeDecodeError / "Unable to read"), /add skipped the vision guard, and get_image_message() never sent the image.

The filename is now lowercased before the comparison. Distinct from #5587 (OpenRouter variant lookup).

Test plan

  • New tests fail on unmodified main and pass after
  • python -m pytest tests/basic/test_utils.py -v → 3 passed

is_image_file() compared the filename against the lowercase entries in
IMAGE_EXTENSIONS with str.endswith(), so common uppercase names like
DSC_0001.JPG or scan.PDF were not recognized as images. Those files were
then read as text, which fails with a UnicodeDecodeError and reports
"Unable to read", and they also bypassed the model vision/PDF support
checks in /add.

Co-authored-by: Tony Coder <407243179@qq.com>
@tonycoder-hub

Copy link
Copy Markdown
Author

Closing as stale — opened on or before 2026-08-17 and still unmerged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants