fix(app): prefer dropped files over file URIs#20107
Open
diamondplated wants to merge 1 commit intoanomalyco:devfrom
Open
fix(app): prefer dropped files over file URIs#20107diamondplated wants to merge 1 commit intoanomalyco:devfrom
diamondplated wants to merge 1 commit intoanomalyco:devfrom
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes prompt drag-and-drop handling in the app so that real dropped File objects are preferred over text/plain file: URI fallbacks, preventing images from being inserted as file-path references instead of attachments (closes #4668).
Changes:
- Added
getDroppedPromptData(...)helper to centralize drop parsing and enforce precedence:DataTransfer.filesfirst,text/plain file:fallback second. - Updated global drop handler to use the helper and only insert a file-pill when no files are present.
- Added unit tests covering the precedence and fallback behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/app/src/components/prompt-input/drop.ts | Introduces shared drop-parsing logic that prefers real dropped files over file: text fallbacks. |
| packages/app/src/components/prompt-input/drop.test.ts | Adds unit coverage for precedence and fallback behavior. |
| packages/app/src/components/prompt-input/attachments.ts | Switches drop handling to the new helper to fix image drops becoming file references. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Issue for this PR
Closes #4668
Type of change
What does this PR do?
This changes prompt drag-and-drop handling to prefer real dropped files over
text/plainfile:fallbacks. That fixes image drops that were being turned into file references instead of attachments, while keeping the file-path fallback when no real files are present.How did you verify your code works?
bun test --preload ./happydom.ts ./src/components/prompt-input/attachments.test.ts ./src/components/prompt-input/drop.test.tsbun run test:e2e:local -- e2e/prompt/prompt-drop-file.spec.ts e2e/prompt/prompt-drop-file-uri.spec.tsbun run typecheckinpackages/appScreenshots / recordings
N/A
Checklist