« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data/yaml.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 44bca66b..627f559c 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -1452,10 +1452,20 @@ export function filterReferenceErrors(wikiData) {
                     // It should still be reported since the 'Originally Released As' field
                     // was present.
                     const original = find.track(track.originalReleaseTrackByRef, wikiData.trackData, {mode: 'quiet'});
-                    const shouldBeMessage =
+
+                    // Prefer references by name, but only if it's unambiguous.
+                    const originalByName =
                       (original
+                        ? find.track(original.name, wikiData.trackData, {mode: 'quiet'})
+                        : null);
+
+                    const shouldBeMessage =
+                      (originalByName
+                        ? color.green(original.name)
+                     : original
                         ? color.green('track:' + original.directory)
                         : color.green(track.originalReleaseTrackByRef));
+
                     throw new Error(`Reference ${color.red(trackRef)} is to a rerelease, should be ${shouldBeMessage}`);
                   }