fix: ignore Japanese sort tags from file in edit modal

File sort tags containing Japanese characters are incorrect (sort tags
should be romaji/ASCII). Ignore them and keep the romaji index value
instead so the edit modal always shows the correct romaji pre-fill.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-05-26 20:39:49 +02:00
1 parent c73665af58
commit fb605b0b31
1 file changed
+7 -4
+7 -4
View File
@@ -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