« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/urls.js12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/urls.js b/src/urls.js
index 2976a522..5e334c1e 100644
--- a/src/urls.js
+++ b/src/urls.js
@@ -300,14 +300,18 @@ export function getURLsFromRoot({
 
   return (targetFullKey, ...args) => {
     const [groupKey, subKey] = targetFullKey.split('.');
-    return (
-      '/' +
+    const toResult =
       (groupKey === 'localized' && baseDirectory
         ? to('localizedWithBaseDirectory.' + subKey, baseDirectory, ...args)
      : groupKey === 'localizedDefaultLanguage'
         ? to('localized.' + subKey, ...args)
-        : to(targetFullKey, ...args))
-    );
+        : to(targetFullKey, ...args));
+
+    if (getOrigin(toResult)) {
+      return toResult;
+    } else {
+      return '/' + toResult;
+    }
   };
 }