From fb605b0b318a1f01b7462b69fbfee040bb2ead99 Mon Sep 17 00:00:00 2001 From: Honey Date: Tue, 26 May 2026 20:39:49 +0200 Subject: [PATCH] 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 --- src/ui.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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