fix(api): 剪辑计划详情/列表接口rendered_url签名转换,修复OSS 403
CI Build & Deploy Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Production (pull_request) Has been skipped
CI Build & Deploy Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 18s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 40s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 37s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Successful in 2m23s
Auto Approve CI PRs / Auto Approve on CI Green (pull_request) Successful in 2m49s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 1m17s
Auto Merge CI PRs / Auto Merge on CI Green + Approved (pull_request) Successful in 4m9s
AI Code Review / AI Code Review (pull_request) Successful in 7m2s
CI Build & Deploy Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production API Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI Build & Deploy Pipeline / Build Production Web Image (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI Build & Deploy Pipeline / Deploy Production (pull_request) Has been skipped
CI Build & Deploy Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 18s
CI/CD Pipeline / Frontend Lint (pull_request) Successful in 40s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 37s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Successful in 2m23s
Auto Approve CI PRs / Auto Approve on CI Green (pull_request) Successful in 2m49s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 1m17s
Auto Merge CI PRs / Auto Merge on CI Green + Approved (pull_request) Successful in 4m9s
AI Code Review / AI Code Review (pull_request) Successful in 7m2s
#454 OSS 403收尾: - generation status接口的video_url签名已在#467修复 - 本次修复plan详情/列表接口直接返回config的问题 - _to_response中对config.rendered_url自动做签名转换 - 覆盖GET /{plan_id}、列表、创建、更新、复制等所有返回EditPlanResponse的接口 - 新增3个单元测试,47个测试全过 - 失败降级:签名异常时返回原始URL,不阻塞主流程
This commit is contained in:
Executable → Regular
+12
-1
@@ -22,6 +22,7 @@ from datetime import datetime
|
||||
from typing import Any, List, Optional
|
||||
|
||||
from app.auth import AuthenticatedUser, get_current_user
|
||||
from app.core.storage import get_storage_service
|
||||
from app.dependencies import (
|
||||
get_asset_library_repository,
|
||||
get_asset_repository,
|
||||
@@ -251,6 +252,16 @@ class GenerateFromTemplateResponse(BaseModel):
|
||||
|
||||
|
||||
def _to_response(p: EditPlan) -> EditPlanResponse:
|
||||
# 对 config 中的 rendered_url 做签名转换(私有bucket裸URL会403)
|
||||
config = dict(p.config) if p.config else {}
|
||||
raw_rendered_url = config.get("rendered_url", "")
|
||||
if raw_rendered_url:
|
||||
try:
|
||||
storage = get_storage_service()
|
||||
config["rendered_url"] = storage.get_download_url(raw_rendered_url, expires_seconds=86400)
|
||||
except Exception as e:
|
||||
logger.warning("剪辑计划rendered_url签名失败,返回原始URL: plan_id=%s error=%s", p.id, e)
|
||||
|
||||
return EditPlanResponse(
|
||||
id=p.id,
|
||||
template_id=p.template_id,
|
||||
@@ -260,7 +271,7 @@ def _to_response(p: EditPlan) -> EditPlanResponse:
|
||||
result_count=getattr(p, "result_count", 0),
|
||||
project_id=p.project_id or "",
|
||||
created_by_user_id=p.created_by_user_id or "",
|
||||
config=p.config,
|
||||
config=config,
|
||||
created_at=p.created_at,
|
||||
updated_at=p.updated_at,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user