From 8989b157677504235b0356bf9c0e10cf4a3578bb Mon Sep 17 00:00:00 2001 From: Honey Date: Thu, 28 May 2026 00:07:12 +0200 Subject: [PATCH] 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 --- backend/novasonic-server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/novasonic-server.js b/backend/novasonic-server.js index 28d0f11..a339efc 100644 --- a/backend/novasonic-server.js +++ b/backend/novasonic-server.js @@ -190,9 +190,10 @@ app.post('/api/spotify/track-artwork', async (req, res) => { }); // ─── 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; - 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 { const meta = await lookupItunesTrackMeta(artist, title); if (!meta.album && !meta.genre && !meta.year) return res.json({ found: false });