revert: remove /api/v1/register alias — not a valid endpoint, corrected M4 to use /api/v1/files/register

This commit is contained in:
Accusys
2026-05-15 03:12:32 +08:00
parent e5f2bba248
commit 263f017972
2 changed files with 8 additions and 10 deletions

View File

@@ -9,19 +9,14 @@
## 根因
正式端點為 `POST /api/v1/files/register`不是 `POST /api/v1/register`。舊版路由已在某次重構中移除
`POST /api/v1/register` 不是有效端點
已修復:在 build `53d6467` 中新增別名路由,現在兩者皆可用:
正確端點是 `POST /api/v1/files/register`,已存在於所有版本中。
| 端點 | 狀態 |
|------|------|
| `POST /api/v1/files/register` | ✅ 原始端點 |
| `POST /api/v1/register` | ✅ 新增別名(回呼相容) |
## Request 格式
## 修正後 Request
```bash
curl -X POST http://localhost:3002/api/v1/register \
curl -X POST http://localhost:3002/api/v1/files/register \
-H "X-API-Key: ..." \
-H "Content-Type: application/json" \
-d '{
@@ -29,3 +24,7 @@ curl -X POST http://localhost:3002/api/v1/register \
"content_hash": "optional-sha256-hex"
}'
```
## 回呼相容
`POST /api/v1/register` 不需要也**不應該**新增。請 M4 改用正確端點。

View File

@@ -2804,7 +2804,6 @@ pub async fn start_server(host: &str, port: u16) -> anyhow::Result<()> {
let protected_routes = Router::new()
.route("/api/v1/files/register", post(register_file))
.route("/api/v1/register", post(register_file))
.route("/api/v1/files/lookup", get(lookup_file_by_name))
.route("/api/v1/unregister", post(unregister))
.route("/api/v1/files/scan", get(scan_files))