fix: log music root in file-not-found error for diagnosis
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
4f83055edd
commit
6fa9751fb6
1 file changed
+6
-3
@@ -762,14 +762,17 @@ app.post('/api/edit-metadata', async (req, res) => {
|
||||
// 2. Exact recursive search under CONFIG.musicPath.
|
||||
// 3. Fuzzy dir search: same dir, matching track-number prefix or title stem.
|
||||
if (!fs.existsSync(filePath)) {
|
||||
const rebased = _rebasePath(filePath, CONFIG.musicPath);
|
||||
const fileName = path.basename(filePath);
|
||||
const rebased = _rebasePath(filePath, CONFIG.musicPath);
|
||||
const fileName = path.basename(filePath);
|
||||
const rebasedDir = rebased ? path.dirname(rebased) : null;
|
||||
const found = rebased
|
||||
|| _findFileRecursive(CONFIG.musicPath, fileName)
|
||||
|| (rebasedDir && _findFileInDir(rebasedDir, fileName));
|
||||
if (found) { filePath = found; }
|
||||
else return res.status(404).json({ error: `File not found: ${filePath}` });
|
||||
else {
|
||||
console.warn(`[edit-metadata] File not found. nd_path=${filePath} music_root=${CONFIG.musicPath} rebased=${rebased}`);
|
||||
return res.status(404).json({ error: `File not found: ${filePath} (music root: ${CONFIG.musicPath})` });
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve artwork: base64 > URL
|
||||
|
||||
Reference in new issue
Block a user