fix(explorer): make SFTP/SCP upload button open the file picker (#69)#78
Merged
Conversation
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.
149e995 to
0bf49ad
Compare
Closed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Clicking Explorer → Upload file did nothing (#69).
The SFTP/SCP upload handler loaded the dialog plugin via
Function("s","return import(s)")(specifier). AFunction-eval'dimport()resolves its bare specifier (@tauri-apps/plugin-dialog) against the document base URL rather than the module's resolution scope, so it throws. Thecatchthen fell back towindow.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
await import("@tauri-apps/plugin-dialog")withopen({ multiple: true }), so multiple files can be selected at once.enqueue_upload(same path as drag-and-drop) instead of the single-fileuploadcommand: 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.sftp_enqueue_uploadandscp_enqueue_uploadexist with matching arg shapes, anddialog:defaultalready grantsallow-open.Tests
ExplorerView.upload.test.tsx: picker→enqueue flow, single-path normalization, and the cancelled-picker case.tsc --noEmitclean; full Vitest suite passing.Addresses #69