mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
fix(storage): 修复通用管理契约下存储页报未知错误
- usage 动作返回的 StorageUsage pydantic 模型无法透过 Response[Dict[str, Any]] 开放映射校验导致 500,统一转为 dict - support_transtype 返回值恢复 transtype 包装结构,与前端期望一致 - 空结果(无用量/无整理方式)恢复成功空结构语义, 不再因 bool(结果) 被前端客户端当作业务失败弹窗 - dashboard 用量聚合改为 dict 取值;新增响应校验与空结果回归测试
This commit is contained in:
@@ -69,8 +69,8 @@ def _build_storage() -> schemas.Storage:
|
||||
_result = StorageChain().manage_storage(storage=_storage, action=StorageAction.USAGE.value)
|
||||
_usage = _result.get("data") if _result.get("success") else None
|
||||
if _usage:
|
||||
total += _usage.total
|
||||
available += _usage.available
|
||||
total += _usage.get("total") or 0
|
||||
available += _usage.get("available") or 0
|
||||
return schemas.Storage(total_storage=total, used_storage=total - available)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user