feat: harden local shell, SFTP, and desktop session reliability
Finder-launched terminals now inherit a login PATH so tools like ollama resolve, destructive SFTP/editor actions require confirmation, and terminal search plus window dragging work again. SSH forwards and RDP sessions keep listeners and survive reconnect without FastPath crashes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
188f3556ed
commit
08696896f9
223 files changed
+13493
-3423
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import i18n from '../../src/i18n'
|
||||
import { translateErrorMessage } from '../../src/i18n/format'
|
||||
|
||||
describe('translateErrorMessage — SFTP real-device phrases', () => {
|
||||
beforeEach(async () => {
|
||||
await i18n.changeLanguage('zh-CN')
|
||||
})
|
||||
|
||||
it.each([
|
||||
['Permission denied', 'errors:sftp.permissionDenied'],
|
||||
['权限不足,无法访问', 'errors:sftp.permissionDenied'],
|
||||
['SFTP 会话不存在: sftp-1', 'errors:sftp.sessionGone'],
|
||||
['SSH 连接不存在', 'errors:sftp.sessionGone'],
|
||||
['SFTP 正在传输文件,请稍后再试', 'errors:sftp.busy'],
|
||||
['transfer is in progress', 'errors:sftp.busy'],
|
||||
['Unable to startup channel', 'errors:sftp.channelFailed'],
|
||||
['MaxSessions limit', 'errors:sftp.channelFailed'],
|
||||
['文件过大(3.2 MB),编辑上限约 2MB', 'errors:sftp.editTooLarge'],
|
||||
['该文件像是二进制内容,无法用文本编辑器打开', 'errors:sftp.editBinary'],
|
||||
['远程文件不是有效 UTF-8 文本', 'errors:sftp.editNotUtf8'],
|
||||
['传输已取消', 'errors:sftp.transferCancelled'],
|
||||
['No space left on device', 'errors:sftp.diskFull'],
|
||||
['ENOSPC', 'errors:sftp.diskFull'],
|
||||
[
|
||||
'建立远程端口转发失败: [Session(-32)] Unable to complete request for forward-listen',
|
||||
'errors:forward.remoteDenied',
|
||||
],
|
||||
[
|
||||
'建立远程端口转发失败: 远端拒绝监听端口 8080(常见原因:AllowTcpForwarding 未开或仅为 local、PermitListen 未包含该端口、端口已被占用)。可用命令行核对:ssh -R 8080:127.0.0.1:<本地端口> user@host',
|
||||
'errors:forward.remoteDenied',
|
||||
],
|
||||
[
|
||||
'建立远程端口转发失败: 远端拒绝监听特权端口 80(需 root 或改用 ≥1024;另请确认 AllowTcpForwarding / PermitListen,且端口未被占用)。可用命令行核对:ssh -R 80:127.0.0.1:<本地端口> user@host',
|
||||
'errors:forward.remoteDeniedPrivileged',
|
||||
],
|
||||
])('maps %s', (raw, key) => {
|
||||
expect(translateErrorMessage(raw)).toBe(i18n.t(key))
|
||||
})
|
||||
|
||||
it('falls back to raw text when unmatched', () => {
|
||||
expect(translateErrorMessage('weird native blip 0xdead')).toBe('weird native blip 0xdead')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user