Skip to content

fix(app): prefer dropped files over file URIs#20107

Open
diamondplated wants to merge 1 commit intoanomalyco:devfrom
diamondplated:copilot/opencode-issue-4668
Open

fix(app): prefer dropped files over file URIs#20107
diamondplated wants to merge 1 commit intoanomalyco:devfrom
diamondplated:copilot/opencode-issue-4668

Conversation

@diamondplated
Copy link
Copy Markdown

Issue for this PR

Closes #4668

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This changes prompt drag-and-drop handling to prefer real dropped files over text/plain file: 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?

  • Ran bun test --preload ./happydom.ts ./src/components/prompt-input/attachments.test.ts ./src/components/prompt-input/drop.test.ts
  • Ran bun run test:e2e:local -- e2e/prompt/prompt-drop-file.spec.ts e2e/prompt/prompt-drop-file-uri.spec.ts
  • Ran bun run typecheck in packages/app

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 30, 2026 17:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.files first, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Images can not be dragged and dropped

2 participants