fix(#1197): AI Code Review第3轮修复
1. 权限校验str()转换,避免UUID/str类型不匹配 2. 配置写回注释说明,明确拷贝-修改-写回流程完整
This commit is contained in:
@@ -238,9 +238,9 @@ def get_preview_generation_task(
|
||||
if task is None:
|
||||
raise HTTPException(status_code=404, detail=f"预览任务 {task_id} 不存在")
|
||||
|
||||
# 权限校验:任务必须属于当前用户
|
||||
task_user_id = getattr(task, "created_by_user_id", "") or ""
|
||||
if not task_user_id or task_user_id != authenticated_user.user.id:
|
||||
# 权限校验:任务必须属于当前用户(统一转 str 比较,避免 UUID/str 类型差异)
|
||||
task_user_id = str(getattr(task, "created_by_user_id", "") or "")
|
||||
if not task_user_id or task_user_id != str(authenticated_user.user.id):
|
||||
raise HTTPException(status_code=403, detail="无权访问该任务")
|
||||
|
||||
# 校验是否为预览任务
|
||||
|
||||
@@ -1074,6 +1074,7 @@ def _render_video(
|
||||
export_cfg["resolution"] = resolution
|
||||
elif not export_cfg.get("resolution"):
|
||||
export_cfg["resolution"] = f"{OUTPUT_WIDTH}x{OUTPUT_HEIGHT}"
|
||||
# 将修改后的配置写回 virtual_plan(拷贝后的副本,不影响原始数据源)
|
||||
plan_cfg["export"] = export_cfg
|
||||
virtual_plan.config = plan_cfg
|
||||
|
||||
|
||||
Reference in New Issue
Block a user