Repository navigation
fix: upload terminal images to the backend that holds the session - #69
Merged
LukeGus merged 4 commits intoNov 16, 2026
Merged
Conversation
In the desktop app, a terminal whose session was started on the linked
server still posted /image-upload to the app's local backend. That backend
has no such session, so it had no SFTP connection to store the image
through and answered 503 IMAGE_STORAGE_UNAVAILABLE.
Send the upload through usePluginApiFor("remote") when the session's
origin is remote, and through the local client otherwise.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
AI review | Looks safe to merge The PR fixes a desktop app bug by routing terminal image uploads to the backend that holds the SSH session instead of always using the local backend. The change is minimal, well-tested, and introduces no security risks or rule violations. Reviewed 981163e. AI can be wrong, a maintainer still decides. Comment |
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
In the desktop app, pasting or uploading an image into a terminal fails when the session was started on the linked server ("Where connections start" = server, or a host with
connectionOrigin: remote):handleImageUploadposts/image-uploadwithusePluginApi(), which in the desktop app is always the app's local backend. The terminal WebSocket, however, was opened against the server (pluginWsUrl(..., { origin })), so the SSH session lives there. The local backend finds no session for theinstanceId, has no SFTP connection to store the image through, andselectImageStorageModereturnsunavailable.The app's log shows
Terminal image upload receivedfor every attempt; the server's log shows none.Fix
Send the upload to the backend that holds the session:
usePluginApiFor("remote")whensessionOriginRef.currentis"remote", the local client otherwise. The choice is a small pure helper,selectImageUploadApi, next tobuildImageUploadFormData.Why this doesn't change other cases
"local"outside Electron, andusePluginApiForreturns the normal client there anyway."local", so the upload goes where it went before.sessionOriginRefis set on every connect, before the WebSocket opens, so a reconnect keeps it in step with the session.Testing
npm run typecheck,npm run format:checkon the changed files,npm run validate,npm run build: passnpm test: 678 passed (676 before, plus 2 new forselectImageUploadApi)frontend.js: the image is stored on the host and its path is typed at the prompt.I left
CHANGELOG.mdalone becausemainhas no section for the next version yet. Suggested entry under Fixed: "Pasting an image in the desktop app works when the session was started on the linked server".🤖 Generated with Claude Code