fix(02-03): fix upload file selection — pass abs path to refreshFileList

- Options use /app/shows/filename as value
- Upload response returns /app/shows/filename as path
- Pass path directly to refreshFileList so pre-selection matches
This commit is contained in:
Claude
2026-04-06 15:39:21 +00:00
parent f1941a90db
commit 0963ad4a70

View File

@@ -272,19 +272,8 @@ document.getElementById('audio-upload')?.addEventListener('change', async (e) =>
if (beats && beats.beats) {
beatTimestamps = beats.beats;
}
await refreshFileList(`/shows/${path.split('/').pop()}`);
// Auto-select and load the just-uploaded file
const sel = document.getElementById('audio-select');
const serverPath = `/shows/${path.split('/').pop()}`;
if (sel) {
// find matching option and select it
for (const opt of sel.options) {
if (opt.value === serverPath || opt.value === path) {
opt.selected = true;
break;
}
}
}
// Options use /app/shows/filename as value — pass abs path to pre-select
await refreshFileList(path);
loadSelectedFile(path);
} catch (err) {
console.error('[audio] upload error:', err);