# agent_ui: Fix pasted image context showing Image instead of actual filename \(\#52082\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/4466d10df3a6a2546c9502e211c9612d58346970)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 4466d10df3a6a2546c9502e211c9612d58346970

Requested commit: 4466d10df3a6a2546c9502e211c9612d58346970

Commit: 4466d10df3a6a2546c9502e211c9612d58346970

Tree: 2c2b97d02ce8df08a2a8389f18ab06e7e70c2681

Author: Suphachai Phetthamrong

Committer: GitHub

## Message

```
agent_ui: Fix pasted image context showing Image instead of actual filename (#52082)

## What

Fix image context mentions always showing the generic label `Image`
instead of the actual filename when pasting from Finder or picking via
the `+` → Image button in the Agent Panel.

## Why

`insert_images_as_context` hardcoded the crease label to
`MentionUri::PastedImage.name()` (`"Image"`) for every image, regardless
of whether it originated from a named file. Both code paths that load
images from file paths — `paste_images_as_context` and
`add_images_from_picker` — discarded the filename before passing images
to the shared insert function.

## Fix

- `agent_ui/src/mention_set.rs`: Changed `insert_images_as_context` to
accept `Vec<(gpui::Image, SharedString)>` instead of `Vec<gpui::Image>`,
using the provided name as the crease label. In
`paste_images_as_context`, extract `file_name()` from each path and pair
it with the loaded image. Raw clipboard images (screenshots, copy from
image editors) continue to use `"Image"` as there is no filename.

- `agent_ui/src/message_editor.rs`: Same fix for
`add_images_from_picker` — extract `file_name()` from each selected path
and pass it alongside the image.

Closes #52079

## Test Plan

- [x] `cargo build -p agent_ui` compiles clean
- [x]  `cargo fmt --all -- --check` format check
- [x] Manual verification of:
- [x] Copy an image file in Finder (`Cmd+C`), paste into Agent Panel —
mention shows actual filename
   - [x] `+` → Image → pick a file — mention shows actual filename
   - [x] Screenshot paste (`Cmd+Shift+4`) still shows `Image`
   - [x] Regular text paste still works

## Screenshots

<img width="638" height="569" alt="image"
src="https://github.com/user-attachments/assets/859d852c-66f6-4faa-a5fe-59bd34cd3d85"
/>

---
Release Notes:

- Fixed image context mentions always showing `Image` instead of the
actual filename when pasting from Finder or using the image picker in
the Agent Panel
```

## Parents

- [cf4848d74af75682bdbf05d515913ceea9a9919a](https://git.cafe/gitcafe/zed/commit/cf4848d74af75682bdbf05d515913ceea9a9919a?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/4466d10df3a6a2546c9502e211c9612d58346970?format=markdown)
