mirror of
https://github.com/stablyai/orca.git
synced 2026-10-08 16:02:37 +00:00
fix(ssh): open external host images from terminal links (#10323)
* fix(ssh): open external host images from terminal links * fix(ssh): keep external file ownership host-scoped * fix(ssh): reject blank external file owners --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -1066,6 +1066,8 @@ export type PersistedOpenFile = {
|
||||
language: string
|
||||
isPreview?: boolean
|
||||
runtimeEnvironmentId?: string | null
|
||||
/** SSH target that owns an absolute path outside the worktree. */
|
||||
externalSshTargetId?: string
|
||||
/** Unsaved editor buffer captured for hot exit; presence restores the tab dirty. */
|
||||
dirtyDraftContent?: string
|
||||
/** Signature of the disk content the dirty draft is based on; lets restore
|
||||
|
||||
@@ -14,6 +14,55 @@ describe('parseWorkspaceSession', () => {
|
||||
expect(result.ok).toBe(true)
|
||||
})
|
||||
|
||||
it('preserves external SSH file ownership across session parsing', () => {
|
||||
const result = parseWorkspaceSession({
|
||||
activeRepoId: null,
|
||||
activeWorktreeId: 'wt',
|
||||
activeTabId: null,
|
||||
tabsByWorktree: {},
|
||||
terminalLayoutsByTabId: {},
|
||||
openFilesByWorktree: {
|
||||
wt: [
|
||||
{
|
||||
filePath: '/tmp/external.png',
|
||||
relativePath: '/tmp/external.png',
|
||||
worktreeId: 'wt',
|
||||
language: 'png',
|
||||
externalSshTargetId: 'ssh-1'
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
expect(result.ok).toBe(true)
|
||||
if (result.ok) {
|
||||
expect(result.value.openFilesByWorktree?.wt?.[0]?.externalSshTargetId).toBe('ssh-1')
|
||||
}
|
||||
})
|
||||
|
||||
it('rejects blank external SSH file ownership', () => {
|
||||
const result = parseWorkspaceSession({
|
||||
activeRepoId: null,
|
||||
activeWorktreeId: 'wt',
|
||||
activeTabId: null,
|
||||
tabsByWorktree: {},
|
||||
terminalLayoutsByTabId: {},
|
||||
openFilesByWorktree: {
|
||||
wt: [
|
||||
{
|
||||
filePath: '/tmp/external.png',
|
||||
relativePath: '/tmp/external.png',
|
||||
worktreeId: 'wt',
|
||||
language: 'png',
|
||||
externalSshTargetId: ' '
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
expect(result.ok).toBe(false)
|
||||
})
|
||||
|
||||
it('accepts a fully populated session with optional fields', () => {
|
||||
const result = parseWorkspaceSession({
|
||||
activeRepoId: 'repo1',
|
||||
|
||||
@@ -161,6 +161,7 @@ const persistedOpenFileSchema = z.object({
|
||||
language: z.string(),
|
||||
isPreview: z.boolean().optional(),
|
||||
runtimeEnvironmentId: z.string().nullable().optional(),
|
||||
externalSshTargetId: z.string().trim().min(1).optional(),
|
||||
dirtyDraftContent: z.string().optional(),
|
||||
lastKnownDiskSignature: z.string().optional(),
|
||||
readOnly: z.boolean().optional(),
|
||||
|
||||
Reference in New Issue
Block a user