Skip to content

fix(desktop): detect dropped folders so they attach as @folder refs - #56029

Merged
OutThisLife merged 1 commit into
mainfrom
fix/desktop-drop-folder-attach
Jul 1, 2026
Merged

fix(desktop): detect dropped folders so they attach as @folder refs#56029
OutThisLife merged 1 commit into
mainfrom
fix/desktop-drop-folder-attach

Conversation

@jquesnelle

Copy link
Copy Markdown
Collaborator

Dragging a folder from Explorer/Finder into the composer failed with "file not found on gateway and no data_url provided", on local gateways too.

extractDroppedFiles tagged every OS drop as a File-bearing entry, so partitionDroppedFiles routed the folder to the upload pipeline and file.attach tried to read a directory's bytes — a directory has none, and there is no data_url to send. This regressed in 4906dcf, which routed OS drops through file.attach to reach a remote gateway but did not exclude directories, which also carry a File handle.

Detect directories at drop time with DataTransferItem.webkitGetAsEntry(), the only synchronous way to tell a dropped folder from a file. A dropped directory now becomes a path-only entry with isDirectory set, which routes to a @folder: ref exactly like the folder picker, instead of the file upload path that cannot stage a directory.

Process transfer.items before transfer.files: webkitGetAsEntry lives only on items, and claiming the folder's path there first lets the files fallback dedup skip the same entry (Chromium lists a dropped folder in both). Path-based dedup and the getPathForFile resolution are preserved.

Dragging a folder from Explorer/Finder into the composer failed with "file
not found on gateway and no data_url provided", on local gateways too.

extractDroppedFiles tagged every OS drop as a File-bearing entry, so
partitionDroppedFiles routed the folder to the upload pipeline and
file.attach tried to read a directory's bytes — a directory has none, and
there is no data_url to send. This regressed in 4906dcf, which routed
OS drops through file.attach to reach a remote gateway but did not exclude
directories, which also carry a File handle.

Detect directories at drop time with DataTransferItem.webkitGetAsEntry(),
the only synchronous way to tell a dropped folder from a file. A dropped
directory now becomes a path-only entry with isDirectory set, which routes
to a @folder: ref exactly like the folder picker, instead of the file
upload path that cannot stage a directory.

Process transfer.items before transfer.files: webkitGetAsEntry lives only
on items, and claiming the folder's path there first lets the files
fallback dedup skip the same entry (Chromium lists a dropped folder in
both). Path-based dedup and the getPathForFile resolution are preserved.
@jquesnelle
jquesnelle requested a review from OutThisLife July 1, 2026 03:06
@OutThisLife
OutThisLife enabled auto-merge July 1, 2026 03:07
@OutThisLife
OutThisLife merged commit 44ddc55 into main Jul 1, 2026
20 checks passed
@OutThisLife
OutThisLife deleted the fix/desktop-drop-folder-attach branch July 1, 2026 03:08
@alt-glitch alt-glitch added type/bug Something isn't working comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have labels Jul 1, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Competing fix for the desktop OS-dropped-folder bug (#44581). Related open PRs: #44606 (detect via a hermes:fs:isDirectory IPC stat-check) and #50424 (probe the resolved path post-drop). This PR detects directories synchronously at drop time via DataTransferItem.webkitGetAsEntry() — no IPC round-trip. Flagging the cluster for a maintainer to pick one.

waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/desktop Electron desktop app (apps/desktop/*) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants