Files
Nexus/docs/changelog/2026-06-01-posix-path-linux-only.md
T

41 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Changelog:远程路径统一 POSIX/Linux
| 项 | 内容 |
|----|------|
| 日期 | 2026-06-01 |
| 类型 | 修复 / 架构 |
| 动机 | 在 Windows 开发机上 `os.path.join`/`dirname` 会对 `/www/...` 远程路径产生反斜杠,导致 SSH/SFTP/压缩等失败 |
## 变更摘要
- 全仓库审计报告:`docs/audit/2026-06-01-posix-path-full-audit.md`
- 分批审查记录(7 批):`docs/audit/2026-06-01-posix-path-batch-review.md`
- Cursor 规则:`.cursor/rules/nexus-posix-paths.mdc`
- 新增 `server/utils/posix_paths.py`:远程与 Nexus 主机 Unix 路径的规范化、拼接、zip-slip 校验
- 第二轮:`diagnose`/`verify`/`file-diff` 远程目标路径、`sync_engine_v2` rsync 目标路径
- `remote_path_validation.py` 改为复用上述工具,并导出 `remote_join`
- `asyncssh_pool``servers`workerman 检测)、`sync_v2` 全部远程路径操作改用 POSIX API
- 上传临时目录相关逻辑:字符串操作用 `posix_join`/`posix_basename`,真实 I/O 仍用 `os.path.realpath`Nexus 生产为 Linux
- 新增 `tests/test_posix_paths.py`
## 涉及文件
- `server/utils/posix_paths.py`(新)
- `server/api/remote_path_validation.py`
- `server/infrastructure/ssh/asyncssh_pool.py`
- `server/api/servers.py`
- `server/api/sync_v2.py`
- `tests/test_posix_paths.py`(新)
## 迁移 / 重启
- 需重启 `nexus` 后端;前端无变更
## 验证
```bash
pytest tests/test_posix_paths.py -q
ruff check server/utils/posix_paths.py server/api/sync_v2.py
python -c "import server.main"
```