fix(desktop): detect dropped folders so they attach as @folder refs - #56029
Merged
Conversation
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.
OutThisLife
enabled auto-merge
July 1, 2026 03:07
Collaborator
Competing fix for the desktop OS-dropped-folder bug (#44581). Related open PRs: #44606 (detect via a |
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
…rop-folder-attach
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
…rop-folder-attach
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
…rop-folder-attach
This was referenced Jul 14, 2026
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…rop-folder-attach
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
…rop-folder-attach
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.