GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: insert native file path when dropping or pasting non-image files by mfazekas · Pull Request #885 · pingdotgg/t3code

Conversation

@mfazekas

@mfazekas mfazekas commented Mar 11, 2026 •
edited by macroscopeapp Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

What Changed

When dropping or pasting non-image files (e.g. .csv, .json, .txt, .riv) onto the chat composer, their native filesystem path is now inserted at the cursor position instead of being silently ignored. Fixes #557.

  • ChatView: New addComposerAttachments helper partitions files into images and non-images. Both onComposerDrop and onComposerPaste delegate to it. Non-image paths are auto-quoted when containing spaces.
  • ComposerPromptEditor: Added insertText(text) using Lexical's selection.insertText() to insert at the real cursor position, correctly handling @mention nodes.
  • preload.ts: Exposed webUtils.getPathForFile(file) via contextBridge (required since Electron's sandbox blocks file.path).
  • contracts/ipc.ts: Added getPathForFile to DesktopBridge interface.

Why

Dropping or pasting any non-image file silently failed with an "unsupported file type" error

UI Changes

before
Screen.Recording.2026-03-11.at.7.40.34.mov
after
Screen.Recording.2026-03-11.at.7.45.35.mov

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

[!NOTE]

Insert native file paths when dropping or pasting non-image files into the composer

  • Adds addComposerAttachments in ChatView.tsx to split dropped/pasted files into images (handled as before) and non-images (inserted as paths).
  • Non-image file paths are resolved via window.desktopBridge?.getPathForFile(file) (Electron) or fall back to file.name; paths containing spaces are quoted and joined with a space separator.
  • Adds insertTextAndFocus(text) to ComposerPromptEditorHandle in ComposerPromptEditor.tsx, inserting text at the current Lexical selection with automatic focus.
  • Exposes getPathForFile on desktopBridge in preload.ts via Electron's webUtils.getPathForFile.

Macroscope summarized e08a39d.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mfazekas
mfazekas marked this pull request as draft March 11, 2026 06:26
@coderabbitai

coderabbitai Bot commented Mar 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8c81b25c-b864-47ca-a299-c3115daa2d54

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
  • X
  • Mastodon
  • Reddit
  • LinkedIn

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can make CodeRabbit's review stricter and more nitpicky using the `assertive` profile, if that's what you prefer.

Change the reviews.profile setting to assertive to make CodeRabbit's nitpick more issues in your PRs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the vouch:unvouched Author is not yet trusted in the VOUCHED list. label Mar 11, 2026
@mfazekas
mfazekas force-pushed the fix/non-image-drop-paste branch from d912835 to 3698cab Compare March 11, 2026 06:31
@mfazekas
mfazekas marked this pull request as ready for review March 11, 2026 06:51
@mfazekas
mfazekas force-pushed the fix/non-image-drop-paste branch from 3698cab to 61dab45 Compare March 11, 2026 07:27
@binbandit

binbandit commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Speaking of images, can you please attach a before and after if possible?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mfazekas

mfazekas commented Mar 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Speaking of images, can you please attach a before and after if possible?

@binbandit there is before/after video in the description, do you need still images as well?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@binbandit

binbandit commented Mar 11, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Speaking of images, can you please attach a before and after if possible?

@binbandit there is before/after video in the description, do you need still images as well?

Video or GIF is fine, but currently none load.

Screenshot 2026-03-11 at 8 11 19 pm
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mfazekas

mfazekas commented Mar 11, 2026

Copy link
Copy Markdown
Contributor Author

Video or GIF is fine, but currently none load.

@binbandit My bad - was using img tag for video, that did render in safari but not in chrome, fixed now

binbandit reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mfazekas @claude
feat: insert native file path when dropping or pasting non-image files
e08a39d
Previously, only image files could be attached to the composer. Dropping
or pasting any other file type (e.g. .riv, .csv, .json) silently failed
with an "unsupported file type" error, making it impossible to reference
data or asset files by path. Closes pingdotgg#557.

Implementation
──────────────
contracts/ipc.ts
  Added getPathForFile(file) to the DesktopBridge interface.

preload.ts
  Exposed webUtils.getPathForFile(file) via contextBridge. Electron's
  sandbox blocks the legacy file.path property on File objects; the
  webUtils API (available since Electron 32) is the official replacement.

ComposerPromptEditor
  Added insertText(text) to ComposerPromptEditorHandle. Uses Lexical's
  native selection.insertText() to insert at the real cursor position,
  which correctly handles existing @mention nodes. Manipulating the
  plain-text snapshot and calling setPrompt() was not an option: Lexical's
  editor.update() is async, so a synchronous focusComposer() call after
  would read a stale snapshotRef and overwrite the inserted text via
  onChange.

ChatView
  - COMPOSER_FILE_PATH_SEPARATOR constant replaces the magic " " literal.
  - addComposerAttachments(files) is a new unified helper (placed next to
    addComposerImages) that partitions files into images and non-images.
    Images are handled by the existing addComposerImages path. Non-image
    files have their native path resolved via desktopBridge.getPathForFile
    (fallback: file.name in non-Electron contexts), auto-quoted when the
    path contains spaces, joined by COMPOSER_FILE_PATH_SEPARATOR, and
    inserted into the composer via insertText().
  - onComposerDrop and onComposerPaste both delegate to
    addComposerAttachments, eliminating the duplicated partition logic.
    onComposerDrop additionally calls focusComposer() only when no
    non-image files were dropped, since insertText() focuses the editor
    internally as a prerequisite for obtaining a Lexical selection.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@mfazekas
mfazekas force-pushed the fix/non-image-drop-paste branch from 61dab45 to e08a39d Compare March 16, 2026 07:24
@github-actions github-actions Bot added the size:M 30-99 changed lines (additions + deletions). label Mar 16, 2026
This was referenced Apr 16, 2026
fix(server): expose persisted image attachment paths to provider models #2094
Closed
feat(web): attach images dragged from another browser tab #2108
Closed
@itsklimov itsklimov mentioned this pull request Apr 17, 2026
Insert non-image file references on drop/paste #2091
Closed
@juliusmarminge

juliusmarminge commented Jun 10, 2026

Copy link
Copy Markdown
Member

Closing as part of an open-PR triage: this overlaps #2091, which we're keeping as the active candidate for this feature. Thanks for the contribution — if #2091 stalls or misses something covered here, we can revisit.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@juliusmarminge juliusmarminge closed this Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Restricted to only attach image files?

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mfazekas @binbandit @juliusmarminge
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.