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 <noreply@anthropic.com>
This commit is contained in:
1 parent
77bbb18c8d
commit
902243586b
1 file changed
+6
-1
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user