fix: add /api/v1/register alias for backward compatibility
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# Register API 404 — 回覆
|
||||
|
||||
**Date**: 2026-05-14
|
||||
**From**: M5
|
||||
**To**: M4
|
||||
**Ref**: `2026-05-14_register_api_404.md`
|
||||
|
||||
---
|
||||
|
||||
## 根因
|
||||
|
||||
正式端點為 `POST /api/v1/files/register`,不是 `POST /api/v1/register`。舊版路由已在某次重構中移除。
|
||||
|
||||
已修復:在 build `53d6467` 中新增別名路由,現在兩者皆可用:
|
||||
|
||||
| 端點 | 狀態 |
|
||||
|------|------|
|
||||
| `POST /api/v1/files/register` | ✅ 原始端點 |
|
||||
| `POST /api/v1/register` | ✅ 新增別名(回呼相容) |
|
||||
|
||||
## Request 格式
|
||||
|
||||
```bash
|
||||
curl -X POST http://localhost:3002/api/v1/register \
|
||||
-H "X-API-Key: ..." \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"file_path": "/path/to/file.svg",
|
||||
"content_hash": "optional-sha256-hex"
|
||||
}'
|
||||
```
|
||||
@@ -2804,6 +2804,7 @@ 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))
|
||||
|
||||
Reference in New Issue
Block a user