diff --git a/src/ui.js b/src/ui.js index 93a402c..77e0f74 100644 --- a/src/ui.js +++ b/src/ui.js @@ -368,10 +368,13 @@ export function toggleInfoEdit() { return fetch(`${S.cfg.backendUrl}/api/song-sorttags?${p}`).then(r => r.ok ? r.json() : null).catch(() => null); }).then(t => { if (!t) return; - if (t.titleSort) document.getElementById('ie-titlesort').value = t.titleSort; - if (t.artistSort) document.getElementById('ie-artistsort').value = t.artistSort; - if (t.albumArtistSort) document.getElementById('ie-albumartistsort').value = t.albumArtistSort; - if (t.albumSort) document.getElementById('ie-albumsort').value = t.albumSort; + const _jp = /[ぁ-んァ-ン一-龯]/; + // Only use file sort tags if they are non-Japanese (romaji/ASCII) — Japanese sort tags + // in the file are incorrect and should be ignored in favour of the romaji index value. + if (t.titleSort && !_jp.test(t.titleSort)) document.getElementById('ie-titlesort').value = t.titleSort; + if (t.artistSort && !_jp.test(t.artistSort)) document.getElementById('ie-artistsort').value = t.artistSort; + if (t.albumArtistSort && !_jp.test(t.albumArtistSort)) document.getElementById('ie-albumartistsort').value = t.albumArtistSort; + if (t.albumSort && !_jp.test(t.albumSort)) document.getElementById('ie-albumsort').value = t.albumSort; }).catch(() => {}); // Art preview — use existing cover