« get me outta code hell

urls: getURLsFromRoot: do that getOrigin funky - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-01-26 18:48:59 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-01-26 18:48:59 -0400
commit689d49f28a258a985e2ce7ec9c2d3a876a0845d0 (patch)
tree3a3813d99519834beb206d50b80bb833995d5531
parent9283c64ea17fab9c9fa1a73f079269a171a26918 (diff)
urls: getURLsFromRoot: do that getOrigin funky
-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;
+    }
   };
 }