Skip to content

fix(explorer): make SFTP/SCP upload button open the file picker (#69)#78

Merged
macnev2013 merged 1 commit into
mainfrom
fix/69-explorer-upload-picker
Jun 15, 2026
Merged

fix(explorer): make SFTP/SCP upload button open the file picker (#69)#78
macnev2013 merged 1 commit into
mainfrom
fix/69-explorer-upload-picker

Conversation

@macnev2013

@macnev2013 macnev2013 commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Problem

Clicking Explorer → Upload file did nothing (#69).

The SFTP/SCP upload handler loaded the dialog plugin via Function("s","return import(s)")(specifier). A Function-eval'd import() resolves its bare specifier (@tauri-apps/plugin-dialog) against the document base URL rather than the module's resolution scope, so it throws. The catch then fell back to window.prompt(...) — a no-op in Tauri's macOS WKWebView — so the click produced no visible result.

The S3 browser and the SFTP drag-and-drop path both already use the correct await import("@tauri-apps/plugin-dialog"), which is why those worked (and why drag-drop was the maintainer's suggested workaround).

This slipped past CI because the e2e upload specs invoke the backend command directly — the native OS file picker can't be driven by WebdriverIO.

Fix

  • Use a plain await import("@tauri-apps/plugin-dialog") with open({ multiple: true }), so multiple files can be selected at once.
  • Route the selection through enqueue_upload (same path as drag-and-drop) instead of the single-file upload command: it walks directories (so folders work too), reports progress in the transfer overlay, and the existing completion listener refreshes the listing — so the premature immediate reload is dropped.
  • Works for both SFTP and SCP (the view is shared); both sftp_enqueue_upload and scp_enqueue_upload exist with matching arg shapes, and dialog:default already grants allow-open.

Tests

  • New ExplorerView.upload.test.tsx: picker→enqueue flow, single-path normalization, and the cancelled-picker case.
  • tsc --noEmit clean; full Vitest suite passing.

Addresses #69

Clicking Explorer → Upload file did nothing. The handler loaded the
dialog plugin via `Function("s","return import(s)")`, which resolves the
bare specifier against the document base URL and throws, then fell back
to `window.prompt` — a no-op in the macOS WKWebView. So nothing happened.

- Use a plain `await import("@tauri-apps/plugin-dialog")` (the pattern the
  S3 browser and the SFTP drag-drop path already use) with
  `open({ multiple: true })`, so multiple files can be picked at once.
- Route the selection through `enqueue_upload` instead of the single-file
  `upload` command, matching drag-and-drop: it walks directories, reports
  progress in the transfer overlay, and the existing completion listener
  refreshes the listing — so the premature immediate reload is dropped.
- Add a Vitest spec covering the picker→enqueue flow, single-path
  normalization, and the cancelled-picker case.
@macnev2013 macnev2013 force-pushed the fix/69-explorer-upload-picker branch from 149e995 to 0bf49ad Compare June 15, 2026 18:09
@macnev2013 macnev2013 merged commit 8e712e4 into main Jun 15, 2026
7 checks passed
@macnev2013 macnev2013 added this to the v0.10.4 milestone Jun 15, 2026
@macnev2013 macnev2013 deleted the fix/69-explorer-upload-picker branch June 15, 2026 19:45
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