fix: pass id-based iTunes lookup requests through to proxy

/api/itunes/lookup was returning 400 for any request without artist+title,
including id-based lookups (?id=...&entity=album) used by the artist page.
Use next() to fall through to the /:endpoint proxy for those requests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-05-28 00:07:12 +02:00
1 parent 2df5a54985
commit 8989b15767
1 file changed
+3 -2
+3 -2
View File
@@ -190,9 +190,10 @@ app.post('/api/spotify/track-artwork', async (req, res) => {
}); });
// ─── ITUNES METADATA LOOKUP (must be before the proxy route) ───────────────── // ─── ITUNES METADATA LOOKUP (must be before the proxy route) ─────────────────
app.get('/api/itunes/lookup', async (req, res) => { app.get('/api/itunes/lookup', async (req, res, next) => {
const { artist, title } = req.query; const { artist, title } = req.query;
if (!artist || !title) return res.status(400).json({ error: 'artist and title required' }); // ID-based lookups (?id=...) are not for track meta — let them fall through to the proxy.
if (!artist || !title) return next();
try { try {
const meta = await lookupItunesTrackMeta(artist, title); const meta = await lookupItunesTrackMeta(artist, title);
if (!meta.album && !meta.genre && !meta.year) return res.json({ found: false }); if (!meta.album && !meta.genre && !meta.year) return res.json({ found: false });