« get me outta code hell

content: linkExternal: fix decoding spaces etc - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2026-03-28 07:34:20 -0300
committer(quasar) nebula <qznebula@protonmail.com>2026-03-28 07:34:20 -0300
commitad012a8297f38eb66cf5e5253c0323353956e9a8 (patch)
treec923fab1def914387922b9e437e32577d88c91cd /src/content
parent3008759e99fc8e2031980e6a4de6f74691938fd7 (diff)
content: linkExternal: fix decoding spaces etc
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/linkExternal.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/content/dependencies/linkExternal.js b/src/content/dependencies/linkExternal.js
index 53ff033f..e1393455 100644
--- a/src/content/dependencies/linkExternal.js
+++ b/src/content/dependencies/linkExternal.js
@@ -83,10 +83,11 @@ export default {
     let href;
     if (urlIsValid) {
       const {canonicalBase, canonicalMediaBase} = data;
+      const past = front => decodeURIComponent(url.slice(front.length));
       if (canonicalMediaBase && url.startsWith(canonicalMediaBase)) {
-        href = to('media.path', url.slice(canonicalMediaBase.length));
+        href = to('media.path', past(canonicalMediaBase));
       } else if (canonicalBase && url.startsWith(canonicalBase)) {
-        href = to('shared.path', url.slice(canonicalBase.length));
+        href = to('shared.path', past(canonicalBase));
       } else {
         href = url;
       }