From 902243586ba77c54e888ccc6beec4c753253859c Mon Sep 17 00:00:00 2001 From: Honey Date: Fri, 19 Jun 2026 11:39:35 +0200 Subject: [PATCH] fix(backend): match files when Navidrome stem desyncs by release suffix After the embedded-title change (recognize vs "recognize - Single"), Navidrome's title-derived stem can drop the "- Single"/"- EP" suffix the on-disk filename still carries, so _findFileByStem matched neither exact nor suffix and every fallback failed -> "File not found on disk" on edit/delete. Now also match on the structured prefix in both directions. Co-Authored-By: Claude Opus 4.8 --- backend/novasonic-server.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/novasonic-server.js b/backend/novasonic-server.js index b415e8f..177bc65 100644 --- a/backend/novasonic-server.js +++ b/backend/novasonic-server.js @@ -119,7 +119,12 @@ function _findFileByStem(dir, titleStem, depth = 0) { // Match: exact, or "Artist - Title" ending with our title stem if (bareStem === normTitle || bareStem.endsWith(' - ' + normTitle) || - bareStem.endsWith(normTitle)) { + bareStem.endsWith(normTitle) || + // Release-suffix desync: Navidrome's title-derived stem ("… - recognize") + // may lack the "- Single"/"- EP" suffix the on-disk filename still carries + // ("… - recognize - single"), or vice-versa. Match on the structured prefix. + bareStem.startsWith(normTitle + ' - ') || + normTitle.startsWith(bareStem + ' - ')) { return path.join(dir, entry.name); } }