Pictures on the desktop: read the file from the event, not the page #326

Merged
littlefox merged 1 commit from issue-317-desktop-image-pick into main 2026-10-24 07:08:49 +00:00
Owner

Closes #317

Every picture picked in the desktop app failed with "bad image". Dioxus desktop opens its own file dialog and gives the page's input an empty stand-in, which the picker read.

  • The bytes now come from the change event (FileData::read_bytes). On the desktop that reads the file from its path.
  • Pasted and dropped images are read in the page, since the desktop's event has only a path and those have none.
  • The composer keeps the original picked image to scale again on send.
  • When the webview can't show a file, the error now names the file and its type.

Checked:

  • The user's fox.png through a real file dialog in WebKitGTK (blob, data URL and bitmap all load).
  • images, paste, profile and post-image specs on the web: 24 passed.
  • Lint passes all three ways.

Not covered by CI: the desktop's file dialog is the xdg portal, which the headless desktop image doesn't have.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8

Closes #317 Every picture picked in the desktop app failed with "bad image". Dioxus desktop opens its own file dialog and gives the page's input an empty stand-in, which the picker read. - The bytes now come from the change event (`FileData::read_bytes`). On the desktop that reads the file from its path. - Pasted and dropped images are read in the page, since the desktop's event has only a path and those have none. - The composer keeps the original picked image to scale again on send. - When the webview can't show a file, the error now names the file and its type. Checked: - The user's fox.png through a real file dialog in WebKitGTK (blob, data URL and bitmap all load). - images, paste, profile and post-image specs on the web: 24 passed. - Lint passes all three ways. Not covered by CI: the desktop's file dialog is the xdg portal, which the headless desktop image doesn't have. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8
Pictures on the desktop: read the file from the event, not the page
All checks were successful
perf / perf (pull_request) Has been skipped
ci / check (push) Successful in 8m54s
ci / desktop (push) Successful in 15m41s
ci / e2e (push) Successful in 36m15s
53f07e3078
Every picture picked in the desktop app failed with "Couldn't read the
image: bad image" (the user's profile picture, a plain 200x200 PNG):
Dioxus desktop opens its own file dialog and gives the page's input an
empty stand-in (new File([], path)), which the picker read. The bytes
now come from the change event (FileData::read_bytes, the file itself
on the desktop, the blob on the web) and go to the page to be checked
and scaled as before. A pasted or dropped image is read in the page,
since the desktop's event has only a path and those have none. The
composer keeps the original to scale again on send. When the webview
can't show a file, the message says which file and type.

Checked: the user's file through a real file dialog in WebKitGTK (blob,
data URL and bitmap all load); image, paste, profile and post-image
specs on the web.

Closes #317

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XJW2ocwLunyaLiUwCBHEP8
littlefox referenced this pull request from a commit 2026-10-24 13:23:56 +00:00
Sign in to join this conversation.
No description provided.