Skip to content

Show it a video you love. Get a new video in the same style. An AI crew (Claude Code or Codex) plans, builds and reviews it with you.

fix: reject non-video reference file uploads with 400 status

KozakLordOfMatrix1c758bc593fb
diff --git a/app/server/index.ts b/app/server/index.ts
index 2efdf64..70b6616 100644
--- a/app/server/index.ts
+++ b/app/server/index.ts
@@ -34,6 +34,11 @@ app.post('/api/projects', upload.fields([{ name: 'reference', maxCount: 1 }, { n
const { url, brief = '', agent = 'claude', title } = req.body, lang = ['zh-TW', 'en', 'zh-CN'].includes(req.body.lang) ? req.body.lang : 'zh-TW';
const files = req.files as Record<string, Upload[]> | undefined, ref = files?.reference?.[0];
if (!ref && !isUrl(url)) return res.status(400).json({ error: '請上傳參考影片或貼上影片連結' });
+ if (ref && !['.mp4', '.mov', '.mkv', '.webm', '.avi', '.m4v', '.mpg', '.mpeg'].includes(extname(ref.originalname).toLowerCase())) {
+ try { unlinkSync(ref.path); } catch {}
+ for (const f of Object.values(files || {}).flat()) try { unlinkSync(f.path); } catch {}
+ return res.status(400).json({ error: '這看起來不像影片檔,請上傳影片格式 (.mp4, .mov, .mkv 等)' });
+ }
if (!['claude', 'codex'].includes(agent)) return res.status(400).json({ error: 'agent 必須是 claude 或 codex' });
if (/�/.test(brief + (title || ''))) return res.status(400).json({ error: '需求文字編碼錯誤(請用 UTF-8 送出)' });
// optional review/fix round limits for this project (castRounds, chunkRounds, finalRounds: whole numbers 1–10)