You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Desktop OS file drops provide canonical file:// URLs. The prompt drop handler previously removed only the file: prefix, leaving percent escapes and extra leading slashes in the attachment path. Files with reserved characters such as ? then reached the Read tool as %3F paths and could not be found.
This change parses file:// drops into decoded native paths while retaining the canonical URL for the request. It preserves the existing file:relative/path behavior used by sidebar file-tree drags and covers POSIX paths, Windows drives, UNC hosts, localhost, and unsupported URL inputs.
How did you verify your code works?
Focused drop-to-request tests: 69 passed
Browser tests: 41 passed
bun typecheck in packages/app
bun run build in packages/app
Monorepo pre-push typecheck: 30/30 tasks
no-mistakes review, test, document, and lint gates passed
Screenshots / recordings
Not applicable. This fixes file-path translation at the drag-and-drop request boundary.
AI code review — automated review for reference; please use your judgment.
packages/app/src/components/prompt-input/attachments.ts:41 — Single-slash file:/abs/path URLs (valid per RFC 8089-style producers) miss the file:// branch and fall into the raw-string path, keeping %XX escapes literally in the file path. Why it matters: the very bug this PR fixes (%-encoded names) resurfaces for that URL spelling. Suggestion: route anything matching /^file:\/\//or/^file:\/[^\/]/… more simply: attempt parseFileURL whenever the string starts with file: and only fall back to the opaque-path branch when parsing fails.
packages/app/src/context/file/path.ts:84 — If decodeFilePath throws on malformed percent-sequences ("%E0%A4", "%zz"), a malformed drop payload will throw inside the drop handler instead of being ignored. Why it matters: one bad drag source would break the whole attachment flow with an unhandled exception. Suggestion: guarantee a safe fallback (try/catch returning the raw pathname), and add a test for parseFileURL("file:///tmp/%zz.png").
packages/app/src/components/prompt-input/attachments.ts:39 (nit) — Scheme check is case-sensitive, so FILE://host/p payloads are rejected outright even though new URL() normalizes schemes to lowercase. Cheap fix: compare against input.toLowerCase().startsWith("file:").
packages/app/src/context/file/path.test.ts:60 — Coverage is strong (reserved chars, drive letters, UNC, localhost, canParse fallback). Consider adding the two gap cases from items 1–2 (single-slash URL, malformed escape) so the supported-input contract stays pinned.
— automated review (ox-alpha, round2)
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
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 #42747
Type of change
What does this PR do?
Desktop OS file drops provide canonical
file://URLs. The prompt drop handler previously removed only thefile:prefix, leaving percent escapes and extra leading slashes in the attachment path. Files with reserved characters such as?then reached the Read tool as%3Fpaths and could not be found.This change parses
file://drops into decoded native paths while retaining the canonical URL for the request. It preserves the existingfile:relative/pathbehavior used by sidebar file-tree drags and covers POSIX paths, Windows drives, UNC hosts, localhost, and unsupported URL inputs.How did you verify your code works?
bun typecheckinpackages/appbun run buildinpackages/appScreenshots / recordings
Not applicable. This fixes file-path translation at the drag-and-drop request boundary.
Checklist