Skip to content

feat(file-explorer): support drag-and-drop file import over SSH - #1279

Merged
Jinwoo-H merged 2 commits into
mainfrom
Jinwoo-H/drag-drop-files-ssh
Apr 30, 2026
Merged

Jinwoo-H merged 2 commits into
mainfrom
Jinwoo-H/drag-drop-files-ssh

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds SFTP-based file upload for drag-and-drop imports when connected to an SSH remote
  • The relay's JSON-RPC fs.writeFile is text-only, so we open a direct SFTP channel for binary-safe transfers
  • Threads connectionId through renderer → preload → main to route SSH vs local import paths

Changes

New files:

  • src/main/ssh/sftp-upload.ts — shared SFTP helpers (uploadFile, uploadDirectory, mkdirSftp, sftpPathExists) with stream safety (settled flag, cross-stream destroy) and symlink/special-file guards
  • src/main/ipc/filesystem-import-ssh.ts — SSH import pipeline: connection state validation, per-item error handling, SFTP name deconfliction via lstat, symlink rejection
  • docs/drag-drop-files-ssh.md — design doc

Modified files:

  • src/main/ipc/filesystem-mutations.ts — dispatch to SSH path when connectionId present
  • src/preload/api-types.ts + src/preload/index.ts — added optional connectionId to importExternalPaths IPC
  • src/renderer/.../useFileExplorerImport.ts — derive connectionId from worktree, toast on errors and partial failures
  • src/main/ssh/ssh-relay-deploy-helpers.ts — re-export shared SFTP helpers

Test plan

  • 27 unit tests across filesystem-import.test.ts and filesystem-import-ssh.test.ts (all passing)
  • Local drag-and-drop import still works (no regression)
  • SSH drag-and-drop: single file, multiple files, directories
  • SSH drag-and-drop: name deconfliction when destination file already exists
  • SSH drag-and-drop: symlink sources are rejected with skip status
  • SSH drag-and-drop: partial failures show toast, successful items still import
  • SSH drag-and-drop: disconnected/reconnecting state shows user-friendly error toast
  • TypeScript compiles with zero errors

Made with Orca 🐋

Jinwoo-H and others added 2 commits April 30, 2026 04:00
Add SFTP-based file upload for drag-and-drop imports when connected to
an SSH remote. The relay's JSON-RPC fs.writeFile is text-only, so we
open a direct SFTP channel for binary-safe transfers.

Key changes:
- Thread connectionId through preload → main to route SSH vs local
- New sftp-upload.ts module with uploadFile, uploadDirectory, mkdirSftp
- SSH import path with connection validation, per-item error handling,
  SFTP name deconfliction, symlink rejection, partial-failure toast
- 27 tests covering local + SSH paths including edge cases

Co-authored-by: Orca <help@stably.ai>
The formatter expanded compact one-liners, pushing the single test file
over the 300-line oxlint limit. Split into routing/connection tests and
operation tests.

Co-authored-by: Orca <help@stably.ai>
@Jinwoo-H
Jinwoo-H force-pushed the Jinwoo-H/drag-drop-files-ssh branch from 9912cb6 to 2876f5d Compare April 30, 2026 08:00
@Jinwoo-H
Jinwoo-H merged commit cb73b37 into main Apr 30, 2026
3 of 4 checks passed
@Jinwoo-H
Jinwoo-H deleted the Jinwoo-H/drag-drop-files-ssh branch April 30, 2026 08:28
mralexsaavedra pushed a commit to mralexsaavedra/orca that referenced this pull request May 2, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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.

1 participant