fix(cover): 修复 OSS 路径双斜杠导致 MediaKit 404 (#1357)
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 2m15s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 2m41s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 2m53s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 3m40s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 5m20s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 6m42s
CI/CD Pipeline / Unit Tests (push) Successful in 10m9s
CI/CD Pipeline / Integration Tests (push) Successful in 3m38s
CI/CD Pipeline / Build Staging API Image (push) Successful in 14m40s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 46s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 39s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 2m10s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 2m50s
CI/CD Pipeline / Canary Release to Production (push) Failing after 813h17m29s
CI/CD Pipeline / CI Gate (push) Failing after 813h25m25s
CI/CD Pipeline / Production Browser E2E (push) Failing after 813h25m35s
CI/CD Pipeline / Deploy Production (push) Failing after 813h25m36s
CI/CD Pipeline / Build Production API Image (push) Failing after 813h25m38s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 813h25m37s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 813h35m45s
CI/CD Pipeline / PR Build Web Image (push) Failing after 813h35m45s
CI/CD Pipeline / Frontend Lint (push) Failing after 813h35m47s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 813h35m49s
CI/CD Pipeline / Build Production Web Image (push) Failing after 813h59m9s
CI/CD Pipeline / PR Build API Image (push) Failing after 814h9m18s
CI/CD Pipeline / Validate - Migration (alembic) (push) Successful in 2m15s
CI/CD Pipeline / Validate - Type Check (mypy) (push) Successful in 2m41s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 2m53s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 3m40s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 5m20s
CI/CD Pipeline / Validate - Code Quality (push) Successful in 6m42s
CI/CD Pipeline / Unit Tests (push) Successful in 10m9s
CI/CD Pipeline / Integration Tests (push) Successful in 3m38s
CI/CD Pipeline / Build Staging API Image (push) Successful in 14m40s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 46s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 39s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 2m10s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 2m50s
CI/CD Pipeline / Canary Release to Production (push) Failing after 813h17m29s
CI/CD Pipeline / CI Gate (push) Failing after 813h25m25s
CI/CD Pipeline / Production Browser E2E (push) Failing after 813h25m35s
CI/CD Pipeline / Deploy Production (push) Failing after 813h25m36s
CI/CD Pipeline / Build Production API Image (push) Failing after 813h25m38s
CI/CD Pipeline / Build Production Worker Image (push) Failing after 813h25m37s
CI/CD Pipeline / PR Build Worker Image (push) Failing after 813h35m45s
CI/CD Pipeline / PR Build Web Image (push) Failing after 813h35m45s
CI/CD Pipeline / Frontend Lint (push) Failing after 813h35m47s
CI/CD Pipeline / Check if frontend-only change (push) Failing after 813h35m49s
CI/CD Pipeline / Build Production Web Image (push) Failing after 813h59m9s
CI/CD Pipeline / PR Build API Image (push) Failing after 814h9m18s
Co-authored-by: xiaoxia <dev@xiaoxiajianji.com> Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
This commit was merged in pull request #1357.
This commit is contained in:
@@ -137,6 +137,12 @@ def editor_generate_cover(
|
||||
|
||||
storage_svc = get_shared_storage_service()
|
||||
primary_video_url = storage_svc.get_url(rendered_storage_key)
|
||||
# 防御性规范化:合并路径中的双斜杠(// -> /),但保留协议头的 ://
|
||||
# 历史数据中 project_id 为空时会产生 projects//tasks/ 路径,
|
||||
# MediaKit 的 HTTP 客户端会规范化 URL 导致 404
|
||||
if primary_video_url:
|
||||
import re as _re
|
||||
primary_video_url = _re.sub(r'(?<!:)//', '/', primary_video_url)
|
||||
logger.info(
|
||||
"获取预览视频URL用于封面生成: plan_id=%s url=%s",
|
||||
plan_id,
|
||||
|
||||
@@ -223,7 +223,12 @@ def _get_task_output_url(task, gen_task_repo, db) -> str:
|
||||
use_case = ListGeneratedVideosByTaskUseCase(video_repo)
|
||||
videos = use_case.execute(task.id)
|
||||
if videos:
|
||||
return getattr(videos[0], "file_url", "") or ""
|
||||
url = getattr(videos[0], "file_url", "") or ""
|
||||
# 规范化:合并路径中的双斜杠(保留协议头 ://)
|
||||
if url:
|
||||
import re as _re
|
||||
url = _re.sub(r"(?<!:)//", "/", url)
|
||||
return url
|
||||
except Exception:
|
||||
pass
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user