Files
Nexus/docs/changelog/2026-06-01-asyncssh-sftp-api-fix.md
T

26 lines
790 B
Markdown
Raw Normal View History

# 2026-06-01 修复 SFTP APIcreate_sftp_client → start_sftp_client
## 摘要
修复文件上传/下载/写入时 `SSH 连接失败: 'SSHClientConnection' object has no attribute 'create_sftp_client'`
## 动机
asyncssh 2.x 的 `SSHClientConnection` 仅提供 `start_sftp_client()`,不存在 `create_sftp_client()`
## 涉及文件
| 文件 | 变更 |
|------|------|
| `server/infrastructure/ssh/asyncssh_pool.py` | 新增 `sftp_session()` 上下文管理器 |
| `server/api/sync_v2.py` | upload / download / write-file 改用 `sftp_session` |
## 迁移 / 重启
需重启 `nexus` Supervisor 进程。
## 验证方式
1. 文件管理 → 编辑并保存 → 应成功(`/api/sync/write-file`)。
2. 上传、下载文件不再返回 502 与上述 AttributeError。