fix(lipsync): video_url扩展名校验放宽,支持MOV/M4V/WebM/AVI/MKV/3GP
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 1s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m19s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 2m18s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 2m31s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m56s
AI Code Review / AI Code Review (pull_request) Successful in 6m45s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 6m44s
CI/CD Pipeline / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 66h0m2s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 66h0m14s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 66h0m14s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 66h0m18s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 65h59m50s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 65h59m44s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 65h59m49s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 65h59m50s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 65h59m54s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 65h59m54s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 65h59m39s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 65h59m35s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 65h59m50s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 65h59m56s
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 1s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 2m19s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 2m18s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 2m31s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m56s
AI Code Review / AI Code Review (pull_request) Successful in 6m45s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 6m44s
CI/CD Pipeline / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Has been cancelled
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 66h0m2s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 66h0m14s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 66h0m14s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 66h0m18s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 65h59m50s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 65h59m44s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 65h59m49s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 65h59m50s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 65h59m54s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 65h59m54s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 65h59m39s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 65h59m35s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 65h59m50s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 65h59m56s
iPhone等设备拍摄的视频转h264后容器保留.MOV扩展名, 原校验仅允许.mp4导致对口型接口返回422。 同步更新单测。
This commit is contained in:
@@ -82,8 +82,11 @@ class CreateLipsyncJobRequest(BaseModel):
|
||||
if not video.startswith(("http://", "https://")):
|
||||
raise ValueError("video_url 必须是 HTTP/HTTPS URL")
|
||||
lower = video.lower().split("?")[0]
|
||||
if not lower.endswith(".mp4"):
|
||||
raise ValueError("video_url 仅支持 MP4 格式")
|
||||
allowed_video_exts = (".mp4", ".mov", ".m4v", ".webm", ".avi", ".mkv", ".3gp")
|
||||
if not any(lower.endswith(ext) for ext in allowed_video_exts):
|
||||
raise ValueError(
|
||||
"video_url 格式不支持,仅支持: " + ", ".join(allowed_video_exts)
|
||||
)
|
||||
|
||||
has_audio = bool((self.audio_url or "").strip())
|
||||
has_tts = bool((self.voice_id or "").strip()) and bool((self.script_text or "").strip())
|
||||
|
||||
@@ -91,16 +91,27 @@ class TestSchemaValidation:
|
||||
assert req.voice_id == "longxiaochun_v3"
|
||||
assert req.script_text == "大家好,欢迎来到直播间"
|
||||
|
||||
def test_invalid_video_url_not_mp4(self):
|
||||
def test_invalid_video_url_unsupported_ext(self):
|
||||
from app.schemas.lipsync import CreateLipsyncJobRequest
|
||||
|
||||
with pytest.raises(ValueError, match="MP4"):
|
||||
# 不支持的扩展名(.txt)应报错
|
||||
with pytest.raises(ValueError, match="格式不支持"):
|
||||
CreateLipsyncJobRequest(
|
||||
video_url="https://example.com/video.mov",
|
||||
video_url="https://example.com/video.txt",
|
||||
voice_id="longxiaochun_v3",
|
||||
script_text="测试文本",
|
||||
)
|
||||
|
||||
def test_mov_video_url_accepted(self):
|
||||
from app.schemas.lipsync import CreateLipsyncJobRequest
|
||||
|
||||
# .MOV 是 iPhone 拍摄的常见容器,h264 编码可直接被 MediaKit 处理
|
||||
req = CreateLipsyncJobRequest(
|
||||
video_url="https://example.com/video.mov",
|
||||
audio_url="https://example.com/audio.mp3",
|
||||
)
|
||||
assert req.video_url.endswith(".mov")
|
||||
|
||||
def test_invalid_video_url_empty(self):
|
||||
from app.schemas.lipsync import CreateLipsyncJobRequest
|
||||
|
||||
|
||||
Reference in New Issue
Block a user