fix(desktop): handle OS-dropped folders — detect directories via stat, route to attachContextFolderPath - #44606
Closed
thedavidweng wants to merge 1 commit into
Closed
Conversation
When a folder is dragged from Finder/Explorer into the Desktop composer, the browser File API does not expose isDirectory, so the drop handler treated it as a regular file. On submit, readFileDataUrl threw EISDIR, and the gateway received no data_url — producing the error: file not found on gateway and no data_url provided Add a lightweight hermes:fs:isDirectory IPC call that stat-checks the resolved path. In attachDroppedItems, use it to detect OS-dropped directories before the image/file branch and route them through attachContextFolderPath, matching the existing in-app folder drag behavior. Copy-paste of folders from Finder remains unhandled (the clipboard handler only processes image blobs); that is a separate concern.
Contributor
|
Thanks for the focused Desktop reproduction and fix direction. This is an automated hermes-sweeper review; the reported behavior is already implemented on current
Closing as implemented on main. |
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.
What
When a folder is dragged from Finder/Explorer into the Desktop composer, the browser
FileAPI does not exposeisDirectory, so the drop handler treated it as a regular file. On submit,readFileDataUrlthrewEISDIR, and the gateway received nodata_url— producing:Changes
main.cjs— newhermes:fs:isDirectoryIPC handler that stat-checks the resolved path (uses existingresolveRequestedPathForIpcfor path safety).preload.cjs— expose the new IPC method aswindow.hermesDesktop.isDirectory(path).use-composer-actions.ts— inattachDroppedItems, before the image/file branch for OS drops, checkisDirectoryvia the new IPC call. If true, route throughattachContextFolderPath— matching the existing in-app folder drag behavior (creates akind: 'folder'attachment with@folder:ref).global.d.ts— addisDirectoryto thehermesDesktoptype definition.What is NOT included
handlePasteincomposer/index.tsx) only processes image blobs. Detecting folder paste events requires a different approach (the clipboard API doesn't expose file-system paths for pasted directories). This is a separate concern.Testing
@folder:reference and be able to list its contentsCloses #44581