Commit 709fdc2
authored
Sync blocklist image extensions with is_binary_file (#9397)
## Description
Follow-up to #9395 in a different file. While auditing image-extension
lists across the repo I found a third copy in
`is_supported_blocklist_image_source`
(`app/src/ai/blocklist/block/view_impl/common.rs`) that suffers from the
exact same drift: it only matches `jpg | jpeg | png | gif | webp | svg`,
missing `.bmp`, `.tiff` / `.tif`, and `.ico`. So inline references to
local `.bmp` / `.tiff` / `.ico` images in agent block output fail the
support check and don't render as the inline image — they silently fall
back to plain text — even though the same files do route to the system
viewer once #9395 lands.
```diff
- "jpg" | "jpeg" | "png" | "gif" | "webp" | "svg"
+ "jpg" | "jpeg" | "png" | "gif" | "bmp" | "tiff" | "tif" | "webp" | "ico" | "svg"
```
The full picture, for context:
| Location | What it does | Pre-fix |
|---|---|---|
| `crates/warp_util/src/file_type.rs` (`is_binary_file`) | Canonical
binary-file extension list | 9 image formats |
| `app/src/util/openable_file_type.rs` (`is_supported_image_file`) |
Routes click-to-open to `FileTarget::SystemGeneric` | 6 formats — fixed
in #9395 |
| **This PR** — `app/src/ai/blocklist/block/view_impl/common.rs`
(`is_supported_blocklist_image_source`) | Gates inline rendering of
agent block image references | 6 formats |
| `crates/warpui_core/src/platform/file_picker.rs` (`FileType::Image`) |
Theme-creator file-picker filter | 3 formats — left for a separate PR;
the right "what should be selectable as a theme background" set is more
subjective |
## Testing
- Added
`is_supported_blocklist_image_source_covers_common_local_formats` in
`common_tests.rs`. Asserts every supported extension passes (10 cases),
case-insensitivity (`PHOTO.PNG`, `scan.TIFF`), and that HTTP / HTTPS
sources and non-image extensions still return false. Fails on master for
the four new extensions, passes after the change.
- `cargo fmt -p warp -- --check` passes locally.
- Couldn't run `cargo nextest` locally because the Metal toolchain isn't
installed (same caveat as #9277, #9345, #9346, #9395) — relying on CI
for the full clippy / nextest pass.
## Related
- #9395 — same fix for `is_supported_image_file` (file-open routing
path).
## Changelog Entries for Stable
CHANGELOG-BUG-FIX: Inline `.bmp`, `.tiff` / `.tif`, and `.ico` images in
agent block output now render correctly instead of falling back to plain
text.
Co-authored-by: anshul-garg27 <anshul-garg27@users.noreply.github.com>1 parent 7784428 commit 709fdc2
2 files changed
Lines changed: 44 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2312 | 2312 | | |
2313 | 2313 | | |
2314 | 2314 | | |
2315 | | - | |
| 2315 | + | |
2316 | 2316 | | |
2317 | 2317 | | |
2318 | 2318 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
0 commit comments