Fix reference audio upload URL and validation

- Fix double /audio/ prefix in reference audio URLs (upload() already returns the public path)
- Allow reference audio as alternative to style/lyrics in custom mode validation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
fspecii
2026-02-04 21:28:40 +02:00
parent 2f567580bc
commit b95936d07d
+3 -3
View File
@@ -152,7 +152,7 @@ router.post('/upload-audio', authMiddleware, audioUpload.single('audio'), async
const ext = extFromName || extFromType || '.audio'; const ext = extFromName || extFromType || '.audio';
const key = `references/${req.user!.id}/${Date.now()}-${generateUUID()}${ext}`; const key = `references/${req.user!.id}/${Date.now()}-${generateUUID()}${ext}`;
const storedKey = await storage.upload(key, req.file.buffer, req.file.mimetype); const storedKey = await storage.upload(key, req.file.buffer, req.file.mimetype);
const publicUrl = storage.getPublicUrl(storedKey); const publicUrl = storedKey;
res.json({ url: publicUrl, key: storedKey }); res.json({ url: publicUrl, key: storedKey });
} catch (error) { } catch (error) {
@@ -221,8 +221,8 @@ router.post('/', authMiddleware, async (req: AuthenticatedRequest, res: Response
return; return;
} }
if (customMode && !style && !lyrics) { if (customMode && !style && !lyrics && !referenceAudioUrl) {
res.status(400).json({ error: 'Style or lyrics required for custom mode' }); res.status(400).json({ error: 'Style, lyrics, or reference audio required for custom mode' });
return; return;
} }