chore(backend): include resolved path in delete-song "file not found" error

The delete-song endpoint returned a bare "File not found on disk" with no
context, making path-resolution mismatches impossible to diagnose. Now
reports the Navidrome path, music root, and searched filename — matching the
detail the edit-metadata endpoint already provides.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Opus 4.8 committed 2026-06-19 11:32:46 +02:00
1 parent e93c0c7ab1
commit 77bbb18c8d
1 file changed
+4 -1
+4 -1
View File
@@ -1341,6 +1341,7 @@ app.post('/api/delete-song', async (req, res) => {
return res.status(502).json({ error: `Navidrome lookup failed: ${e.message}` }); return res.status(502).json({ error: `Navidrome lookup failed: ${e.message}` });
} }
const ndPath = filePath; // path exactly as Navidrome reported it (for diagnostics)
if (!path.isAbsolute(filePath)) filePath = path.join(CONFIG.musicPath, filePath); if (!path.isAbsolute(filePath)) filePath = path.join(CONFIG.musicPath, filePath);
if (!fs.existsSync(filePath)) { if (!fs.existsSync(filePath)) {
const fileName = path.basename(filePath); const fileName = path.basename(filePath);
@@ -1350,7 +1351,9 @@ app.post('/api/delete-song', async (req, res) => {
|| _findFileInDir(path.dirname(filePath), fileName) || _findFileInDir(path.dirname(filePath), fileName)
|| _findFileByStemOrRomaji(CONFIG.musicPath, titleStem); || _findFileByStemOrRomaji(CONFIG.musicPath, titleStem);
if (found) filePath = found; if (found) filePath = found;
else return res.status(404).json({ error: 'File not found on disk' }); else return res.status(404).json({
error: `File not found on disk. Navidrome path: "${ndPath}" — music root: "${CONFIG.musicPath}" — searched for: "${fileName}"`,
});
} }
// Safety: file must be inside the music root and must be an audio file // Safety: file must be inside the music root and must be an audio file