feat: implement source link endpoints and enforce policy rules
All checks were successful
Test / test (push) Successful in 1m56s

- Add POST/GET source link endpoints for file sharing via permanent URLs
- Enforce max_size check in PATCH /file/content to prevent size limit bypass
- Support is_private (proxy) vs public (302 redirect) storage modes
- Replace all ResponseBase(data=...) with proper DTOs or 204 responses
- Add 18 integration tests for source link and policy rule enforcement

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-15 17:07:20 +08:00
parent 71883d32c0
commit 1ecc0fdc1c
11 changed files with 1051 additions and 150 deletions

View File

@@ -26,7 +26,6 @@ from sqlmodels import (
PhysicalFile,
Policy,
PolicyType,
ResponseBase,
User,
)
from service.storage import (
@@ -439,9 +438,9 @@ async def router_object_rename(
if '/' in new_name or '\\' in new_name:
raise HTTPException(status_code=400, detail="名称不能包含斜杠")
# 如果名称没有变化,直接返回成功
# 如果名称没有变化,直接返回
if obj.name == new_name:
return ResponseBase(data={"success": True})
return # noqa: already 204
# 检查同目录下是否存在同名对象(仅检查未删除的)
existing = await Object.get(