« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/html.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util/html.js b/src/util/html.js
index a6b0d621..459a1647 100644
--- a/src/util/html.js
+++ b/src/util/html.js
@@ -130,6 +130,14 @@ export function attributes(attribs) {
         throw new Error(`Attribute value for ${key} should be primitive or array, got ${typeof val}`);
     })
     .filter(([_key, _val, keep]) => keep)
+    .map(([key, val]) => {
+      switch (key) {
+        case 'href':
+          return [key, encodeURI(val)];
+        default:
+          return [key, val];
+      }
+    })
     .map(([key, val]) =>
       typeof val === 'boolean'
         ? `${key}`